Solved

Java Compiler

Posted on 2011-02-27
13
348 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
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 500 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
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…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

627 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