Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Java Compiler

Posted on 2011-02-27
13
Medium Priority
?
355 Views
Last Modified: 2012-05-11
I have installed a Java compiler.

Per installation instructions, it appears that the installation was successful.    The following snapshots/documents are attached:

1. "Instructions.jpg" -- according to the instructions, "long message" means success
2. "InstructionFeedback.jpg" -- I get this long message... I figure it was installed successfully
3. "HelloWord -- Instructions.pdf" -- per some website, it was recommended to test the installation via compiling the "Hello World" program...
4. Per #3, I followed the compiling of the Hello World program (page 5 of the PDF).   However, I don't get the ".class" file after typing "HelloWorld.java' (I renamed it from HelloWorldApp to HelloWorld).

What am I missing?

EEH


Installation.jpg
InstallationFeedback.jpg
HelloWord----Instructions.pdf
Java.jpg
0
Comment
Question by:ExpExchHelp
  • 9
  • 4
13 Comments
 
LVL 47

Expert Comment

by:for_yan
ID: 34992811
It looks that you have runtime environment but not jdk. You can run prigrams
with java command but cannot compile them with javac
0
 
LVL 47

Expert Comment

by:for_yan
ID: 34992831
This statement in your window that before you can run java program you need to have java compiler is not correct.
Before you can run you need to install Java Virtual Machine (they can also call it Java Runtime Environmen)
- the  command java corresponds to that.

If you want to write new programs then you need first to compile  - for that you need to have "javac" command which converts
.java file to .class file. if you already have a .claas fie or a .jar file you don't need to compile.

What I see is that after your installation "java" command is wroking, javac is not -  so probabley you installed
Java Runtime Environemnt (JRE) but not Java Development Environment (JDK).

So you fisrt need tio decide what you need - just to run java programs written by others or you also want to write new java programs of your own
and then install what you need accordingly - JRE or JDK
0
 

Author Comment

by:ExpExchHelp
ID: 34992905
for_yan:

I will have to write new programs as well...

What do I need to download/install?  
Do you have a recommendation for a website (for downloading the required software/components?  
If so, do I need to uninstall the current program for proper installation sequence?

EEH
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 47

Expert Comment

by:for_yan
ID: 34992920
It is all on the same web page, but make sure you install JDK, not JRE:

http://www.oracle.com/technetwork/java/javase/downloads/index.html

0
 
LVL 47

Expert Comment

by:for_yan
ID: 34992928
You can uninstall just for cleanliness.
In general I guess same version of JDK should install over JRE -
itshould complain if it does not
0
 

Author Comment

by:ExpExchHelp
ID: 34992994
Hmh... that's the same site I when to yesterday.

And, yes, I did install the JDK... not the JRE.   See snapshot (from yesterday's installation).

So, something else must be causing the problem.

Any additional recommendations?

EEH


jdk.jpg
0
 
LVL 47

Expert Comment

by:for_yan
ID: 34993043
Go into bin --> you should have javac.exe in there

then go to you command prompt and type PATH and find first place where
you have jdk.../bin  or jre.../bin in there.

It may well be that you have your installation on your computer but don't have right PATH
 it in your environement, but you have some JRE from the old time in your ebviroemnt,
therefore java works but javac does noot

0
 
LVL 47

Expert Comment

by:for_yan
ID: 34993049
Also type java -version
and compare is it the same version which you downloaded and installed today
0
 
LVL 47

Expert Comment

by:for_yan
ID: 34993076
And ultmately go to control panel --> system -> advanced tab -> envirinement varaibales
and make sure that in the PTH varaiable the first java you encounter should point to
bin under your recent installation folder something like ...\jdk1.6.0_24\bin - it should come before any other java
in your path
0
 
LVL 47

Accepted Solution

by:
for_yan earned 2000 total points
ID: 34993093
I meant of course "PATH" variable or it may be "Path" - it is case insensitve on Windows
If it points to installation of JDK and not to installation of JRE (which may have been on your computer before)
then both java and javac should work from the command prompt and should use the same version of java.

After you change Environemnt in cpntol panel - start new CMD window and check that correct PATH is there.
Then it should work
0
 

Author Comment

by:ExpExchHelp
ID: 34993198
for_yan:

The "devil is in the detail"....  thanks, that did it.

Even though I had added the directory to the systems environment variables, I had called it "java' not "PATH".

Once I changed that, it successfully created the class file.

Thanks again!!

EEH
0
 

Author Closing Comment

by:ExpExchHelp
ID: 34993199
Excellent solution
0
 
LVL 47

Expert Comment

by:for_yan
ID: 34993237
You are always welcome
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This video teaches viewers about errors in exception handling.
Suggested Courses

963 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question