Advertisement

There's no such thing as a stupid question, but they're the easiest to answer.
Login
Search

Advertisement

Software Development Software Development
Search Search
Search for:
Tech Support Guy > > >

I can't execute a java file from the command prompt.


(!)

truckiewow's Avatar
truckiewow truckiewow is offline
Junior Member with 3 posts.
THREAD STARTER
 
Join Date: Apr 2010
Experience: Beginner
13-Apr-2010, 05:04 PM #1
I can't execute a java file from the command prompt.
I have windows 7, the 64. Whenever I try to use 'java [class name]' in the command prompt, it returns 'Exception in thread "main" java.lang.NoClassDefFoundError: [class name]' The 'javac [class name].java' works fine, and creates the [class name].class file, but the java just won't work. Can anyone help me with this? Thanks
servalsoft's Avatar
servalsoft servalsoft is offline
Junior Member with 6 posts.
 
Join Date: Apr 2010
Experience: Advanced
14-Apr-2010, 08:56 AM #2
How are you running the app?
If you can compile I assume you set up the path and env variables properly. Once you create your .class file, how are you trying to run it? because this exception sometime gets thrown if you try to run with "java <myApp.class>" the correct syntax is "java <myApp>" the name of the class, not of the file.
I hope this helps.
truckiewow's Avatar
truckiewow truckiewow is offline
Junior Member with 3 posts.
THREAD STARTER
 
Join Date: Apr 2010
Experience: Beginner
15-Apr-2010, 10:07 PM #3
I was typing it in as "java <myApp>", but I realized that I had to add the (I think it was the classpath that I changed) to include the specific folder that I had saved some classes and javas to. I can execute the classes that are in that specific folder, but not any other ones. I can type in "javac C:\....<myApp.java>", and it works fine, but I can't just type in the path for the java ("java C:\....<myApp>" doesn't work. Is there a way to make it to where I can just use "java <full path to my app here>", just like I can use "javac <(full path to my app here).java>"?

And thank you for helping me.
servalsoft's Avatar
servalsoft servalsoft is offline
Junior Member with 6 posts.
 
Join Date: Apr 2010
Experience: Advanced
16-Apr-2010, 03:52 AM #4
Sounds like a path problem to me. People get that a lot when installing java. Can you please tell me your java version, where you installed java itself i.e C:\program files....., then show me ur set up of the environment variables for java. So that I can check that at least that is installed properly.
truckiewow's Avatar
truckiewow truckiewow is offline
Junior Member with 3 posts.
THREAD STARTER
 
Join Date: Apr 2010
Experience: Beginner
16-Apr-2010, 10:09 PM #5
I have the 1.6.0_19 version.
It's installed in (the java.exe is in this folder) : C:\Program Files\Java\jdk1.6.0_19\bin
The path variable is "C:\Program Files\Java\jdk1.6.0_19\bin; %CommonProgramFiles%\Microsoft Shared\Windows Live;"

And the classpath is "C:\Users\Michael\Documents\CIS3022\; .; C:\Program Files\Java\jre6\lib\ext\QTJava.zip"
The CIS3022 folder is where I have some of the java files and then their classes
As Seen On

BBC, Reader's Digest, PC Magazine, Today Show, Money Magazine
WELCOME TO TECH SUPPORT GUY!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.


Tags
command prompt, java

(clock)
THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Similar Threads
Title Thread Starter Forum Replies Last Post
HELP!! - unmountable boot volume - no command prompt klad98 Windows XP 11 29-Sep-2009 11:53 AM
Solved: COMMAND PROMPT - Easy way of browsing Windows Chol Tech Tips and Reviews 2 17-Jun-2009 01:43 AM
Running a C program from the command prompt Yesteryear Software Development 1 26-Mar-2009 06:55 PM
Command Prompt CrazyEyes955 Windows Vista 1 30-Aug-2008 11:27 PM
How do I set programs to be run from the command prompt by typing their name? Trag Windows XP 8 21-Apr-2004 10:35 AM

WELCOME
You Are Using: Server ID
Trusted Website Back to the Top ↑