Results 1 to 19 of 19
Thread: .java > .class conversion
- 07-30-2008, 06:20 PM #1
.java > .class conversion
To be simple, I need to find a program or process of some sort that will convert a file with extension name of .java to .class. All attemps I have made to find a way have either come up empty or simply not worked.
I already have a program that will take .class and convert it to .java, but for whatever reason, not the other way around.
So I would greatly appreciate a fairly simple, or at least well explained way of converting .class > .java or a program that will do it for me.
- 07-30-2008, 06:31 PM #2
The javac program will create a .class file from a .java file.
Its called a compiler and most all programming languages have a program that does something like this.
You can get the javac program in Sun's JDK download.
- 07-30-2008, 06:36 PM #3
That is one of the fails I mentioned. In my searches I found out about JDK, so got 6.0. So far I have not figured out how to make it work however. I found a few explanations, but so far, I'm still rather lost on how to make it work due to the lack of a proper 'tutorial' through it I guess.
- 07-30-2008, 06:41 PM #4
Open command prompt type cd then where ever the file is located.
for example: C:\ Documents and Setting>cd userName\so on and so on
then type in javac and the filename
for example: C:\ Documents and Setting\userName\so on and so on>javac myFileName.javaMy IP address is 127.0.0.1
- 07-30-2008, 06:49 PM #5
I'm getting what I got each other time I tried, "'C:\Documents' is not recognized as an internal or external command, operable program or batch file".
- 07-30-2008, 06:51 PM #6
no type in everything from cd onMy IP address is 127.0.0.1
- 07-30-2008, 07:00 PM #7
Did that too. Same results. Not sure what I'm doing wrong here, but obviously there is something.
- 07-30-2008, 07:02 PM #8
Then click on beginner
Then click on your first java program
then readMy IP address is 127.0.0.1
- 07-30-2008, 08:09 PM #9
... I have to say I'm still lost. >_<
I can't seem to get javac to do anything.
There isn't anything specific I have to do to get JDK to work right is there? I read something about the environment variables, but so far that hasn't helped either.
Is there a program that I can just pull the .java file into and basically 'save' as a .class file? Thats pretty much what the program I have for .class > .java does.
- 07-30-2008, 08:23 PM #10Member
- Join Date
- Jul 2008
- Rep Power
check your classpath if javac doesnt work in your console.:DMy community with sourcode and examples :D
Java remote image server/client working proof of concept: uitstekendeaccu.nl/tmp/
- 07-30-2008, 08:37 PM #11
- 07-30-2008, 09:23 PM #12
To show you current Environment variable settings:
Open a console window and enter: SET
copy the results and paste it here.
To copy, click on icon in upper left of the console window, select edit and select Select all
then again and select copy
Then paste it somewhere and then copy it here
- 07-30-2008, 09:32 PM #13
And this gets what done..? :x
Last edited by Fate_Remai; 11-10-2008 at 11:55 AM. Reason: Wished to remove certain info.
- 07-30-2008, 09:50 PM #14
When you enter a command in a console, Windows must find the program before it can load the program and execute it. Windows uses the paths listed in the PATH variable to find command files.
When you installed java you needed to add the path to the bin folder to the PATH variable.
I see that the JDK variable in what you posted has the address to a bin folder for a JDK.
You need to update your Environment variable PATH to include what is in JDK. Use Search for a full description of how to update Environment variables.
Here's what is in my PATH variable:
Path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\Sys tem32\Wbem;C:\Program Files\Java\jdk1.5.0_04\bin;C:\Perl\bin;C:\BatchFil es
- 07-30-2008, 10:19 PM #15
Well that seems to allow javac to work. My remaining problem seems to be getting it to find the file. I understand the 'javac MyFileName.java' thing. I'm not fully sure how to make it find the file I want to convert from .java to .class.
Perhaps it has something to do with my console opening and automatically having 'C:\Documents and Settings\Admin>' rather than simply 'C:\>'? (I don't recall how to reset this by the way)
- 07-30-2008, 11:13 PM #16
Making shortcut to start in java source folder
Make a special shortcut for your desktop to start where your .java files are:
Navigate to where the Command Prompt shortcut is
Rightclick on it and select Copy
Go to your desktop rightclick on it and select Paste.
Rightclick on the shortcut just placed and select Properties
Enter the path to your .java files in the Start In: field.
RC and rename to shortcut to remind you of where it goes or whatever
- 07-31-2008, 01:36 AM #17
Wahlah! It is now working and I can finally do what I have wanted to do. Thank you very much Norm.
I'll be sure to keep this forum in mind if I have any further troubles. ;)
- 07-31-2008, 01:48 AM #18
watch for unpredictable shell hooks
The best approach I know of, the one I am using right now, is to put first work in C:\Documents and Settings\Owner\My Documents and then write programs directly in Java there. Right now I am placing the compiled class files in a directory different from the source files. I copy those manually to where I want them.
In any approach, be totally patient. Frustration does not achieve forward study.Introduction to Programming Using Java.
Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor
- 07-31-2008, 02:12 AM #19
Somewhere you can change the default target directoryh for Windows programs to your own folder. I've never tried, but have often wished I had.
I rarely put anything in the My Documents folder. I have 6 drive letters assigned and use D for work, E for data, F for backups, G for copies of stuff from old computers and H for backups for my wife and from the laptop.
- By praveen.kb in forum Advanced JavaReplies: 2Last Post: 01-16-2009, 01:27 PM
- By tarandeep.singh in forum XMLReplies: 1Last Post: 06-14-2008, 02:17 AM
- By kotturupraveen in forum New To JavaReplies: 2Last Post: 06-09-2008, 12:58 PM
- By thamizhisai in forum New To JavaReplies: 3Last Post: 04-29-2008, 11:55 AM
- By Java Tip in forum Java TipReplies: 0Last Post: 12-07-2007, 01:05 PM