| | |
Compile Java
![]() |
to compile i believe you would run javac file.java and it should compile and to run it you would just use java file.class
and that should do it i believe
you will have to locate these 2 files on your system javac and java i but not sure. this is of course if you are just running a command line program and not an applet 
http://www.iam.ubc.ca/guides/javatut....1/stepbystep/
i have always just used text pad to do all my java stuff in cause you can set it up to compile and run your program
and that should do it i believe
you will have to locate these 2 files on your system javac and java i but not sure. this is of course if you are just running a command line program and not an applet 
http://www.iam.ubc.ca/guides/javatut....1/stepbystep/
i have always just used text pad to do all my java stuff in cause you can set it up to compile and run your program
This link may help you to understand how to compile and run java programs.
The only thing is I cant find which windows operating system its for, probably windows 98, 2000. However it can be easily adapted to windows xp!
LINK
The only thing is I cant find which windows operating system its for, probably windows 98, 2000. However it can be easily adapted to windows xp!
LINK
Only lemmings should jump to conclusions! :rolleyes: Please rate me!
•
•
Join Date: Oct 2006
Posts: 5
Reputation:
Solved Threads: 0
Ok, so I found two lcations of this javac and every time i click on either one of them a window flashes by and disappears? How the heck are you supposed to run javac? How do you compile? The link doesn't help. It assumes you know how to compile. Sorry, I'm new to Java and I just wanna learn how to compile.
•
•
Join Date: Oct 2006
Posts: 101
Reputation:
Solved Threads: 4
open your command prompt.
Change your directory to wherever your programs are...
Eg if they are in C:\java, then:
cd c:\java ENTER
Then javac fileName.java ENTER
That line compiles it, and creates a .class file,
Next... to execute the program...
java fileName.java ENTER
If you used an IDE like netbeans 5.0 or something else, you don't have to bother with this, but they can be confusing to start with, so I recommend just playing with notepad and command prompt till you get the hang of basic java.
Change your directory to wherever your programs are...
Eg if they are in C:\java, then:
cd c:\java ENTER
Then javac fileName.java ENTER
That line compiles it, and creates a .class file,
Next... to execute the program...
java fileName.java ENTER
If you used an IDE like netbeans 5.0 or something else, you don't have to bother with this, but they can be confusing to start with, so I recommend just playing with notepad and command prompt till you get the hang of basic java.
•
•
Join Date: Oct 2006
Posts: 101
Reputation:
Solved Threads: 4
I made a little error above,,,
you just need to do java fileName to execute.
Ok, try this...
cd c:\java ENTER
SET CLASSPATH= ENTER
javac fileName.java ENTER
java fileName ENTER
That might work, but your JDK needs to be set up correctly, the command prompt needs to know the path to the JDK, you can do this by modifying the AUTOEXEC.BAT file.
Let me know how it goes with the commands I mentioned first.
you just need to do java fileName to execute.
Ok, try this...
cd c:\java ENTER
SET CLASSPATH= ENTER
javac fileName.java ENTER
java fileName ENTER
That might work, but your JDK needs to be set up correctly, the command prompt needs to know the path to the JDK, you can do this by modifying the AUTOEXEC.BAT file.
Let me know how it goes with the commands I mentioned first.
•
•
Join Date: Oct 2006
Posts: 5
Reputation:
Solved Threads: 0
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\Compaq_Administrator>cd C:\java
C:\java>SET CLASSPATH=
C:\java>javac HelloWorldApp.java
'javac' is not recognized as an internal or external command,
operable program or batch file.
C:\java>java HelloWorldApp.java
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorldApp/java
C:\java>java HelloWorldApp
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorldApp
Still nothing. The official javasun site had a different way of resetting the path though. I don't understand either way...heh
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\Compaq_Administrator>cd C:\java
C:\java>SET CLASSPATH=
C:\java>javac HelloWorldApp.java
'javac' is not recognized as an internal or external command,
operable program or batch file.
C:\java>java HelloWorldApp.java
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorldApp/java
C:\java>java HelloWorldApp
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorldApp
Still nothing. The official javasun site had a different way of resetting the path though. I don't understand either way...heh
•
•
Join Date: Oct 2006
Posts: 5
Reputation:
Solved Threads: 0
Java Syntax (Toggle Plain Text)
/** * The HelloWorldApp class implements an application that * simply prints "Hello World!" to standard output. */ class HelloWorldApp { public static void main(String[] args) { System.out.println("Hello World!"); // Display the string. } }
![]() |
Similar Threads
- Making A Java Compiler... In Java (Java)
- how to compile java (Windows Vista and Windows 7)
- How to compile java in linux (Java)
- how to compile java programs in ubuntu (Java)
- how to compile in java with many classes (Java)
Other Threads in the Java Forum
- Previous Thread: Java Semantic Analyzer
- Next Thread: Beginner using Java... Having trouble with javac and creation of .class files.
| Thread Tools | Search this Thread |
account android api applet application array arrays automation bidirectional binary birt bluetooth class classes client code columns component constructor database designadrawingapplicationusingjavajslider draw eclipse error errors exception expand fractal game givemetehcodez graphics gui guidancer homework html ide image inetaddress inheritance integer intellij j2me java javamicroeditionuseofmotionsensor javaprojects jlabel jme jni jpanel jtextfield jtree julia linux list loop map method methods midlethttpconnection mobile mobiledevelopmentcreatejar monitoring myaggfun netbeans newbie nullpointerexception open-source oracle plazmic print problem program project property recursion ria scanner search server set sharepoint smart sms smsspam sort sourcelabs splash sql sqlite static string subclass support swing testautomation threads tree unlimited webservices windows





