Results 1 to 7 of 7
Thread: .java to .class issue
- 02-20-2013, 03:45 PM #1
Member
- Join Date
- Feb 2013
- Posts
- 5
- Rep Power
- 0
.java to .class issue
Hello all
I made the HelloWorldApp as suggested by "Hello World!" for Microsoft Windows (The Java™ Tutorials > Getting Started > The "Hello World!" Application) but I ran into an error that couldn't be fixed following the list of errors (or I must have done something wrong, which could be realistically be the solution)
I ran command prompt, ordered it to go to the map where my .java file was stored, entered (after patching it in advanced system configuration) PATH javac HelloWorldApp.java, hit enter, typed dir and I could not see a .class file.
Command prompt didn't give me any error at all, I have saved a couple printscreens to show you guys.
(the computer has dutch as main language, but it doesn't make the problem unclear imo)
The printscreens:



Final notes: yes I'm running vista, I know it sucks, never knew it could possibly make programming more difficult, I'm planning on buying a better computer; I copied the helloworld code from the site when it didn't compile to .class the first time to make sure it was not the code's fault.
Thank you for your attention and I hope you can find the answer to my question soon, I can't wait to run my HelloWorldApp.class file :)
- 02-20-2013, 03:51 PM #2
Re: .java to .class issue
What error are you actually getting when you run javac on your .java file?
How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 02-20-2013, 03:54 PM #3
Re: .java to .class issue
Hi there you've go some things mixed up. PATH needs to include the java/bin directory, i.e. where the java.exe and javac.exe files are. Easy test is : c:>java -version
That should print out the version of your JDK.
The classpath tells the VM where to look for your .java file.
So you go to the direcory where the .java file is and type javac -cp. HelloWorldApp.java
Now you should see the .class file
To run it you type in the same dirctory: java HelloWorldAppMath problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
The Ubiquitous Newbie Tips
- 02-20-2013, 04:00 PM #4
Member
- Join Date
- Feb 2013
- Posts
- 5
- Rep Power
- 0
Re: .java to .class issue
In the printscreen you can see that PATH stands for my current java version, after typing "javac -cp. HelloWorldApp.java" nothing happened, I think this is mainly my computer's fault, but I can be wrong. if it creates a .class file, doesn't it automatically store in the same directory as the original .java file?
EDIT: When I entered "javac -cp. HelloWorldApp.java" this showed up:
javac: invalid flag: -cp.
Usage: javac <options> <source files>
use -help for a list of possible optionsLast edited by Vantrax; 02-20-2013 at 04:05 PM.
- 02-20-2013, 04:13 PM #5
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
Re: .java to .class issue
Put a space between the 'cp' and the '.'
Your earlier problem is down to you starting your command with 'PATH'.Please do not ask for code as refusal often offends.
- 02-20-2013, 04:15 PM #6
Re: .java to .class issue
Thanks, Tolls! Sorry Vantrax, bad typo from my side.
Math problems? Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x]
The Ubiquitous Newbie Tips
- 02-20-2013, 04:18 PM #7
Member
- Join Date
- Feb 2013
- Posts
- 5
- Rep Power
- 0
Similar Threads
-
[SOLVED] Class paths and Packages issue
By kammce in forum New To JavaReplies: 14Last Post: 07-12-2012, 05:10 AM -
Timer Class Issue
By CuppaCoffee in forum New To JavaReplies: 3Last Post: 01-05-2012, 10:31 PM -
Issue in method anonymous class in GWT
By ankit01 in forum GWTReplies: 0Last Post: 05-16-2011, 11:25 AM -
Class cast issue
By AedonetLIRA in forum New To JavaReplies: 5Last Post: 11-19-2010, 04:34 PM -
Calendar class issue
By OlegKo in forum New To JavaReplies: 3Last Post: 10-24-2010, 06:36 PM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks