• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

java on Windows 10

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I downloaded java (I think) from java.com - big red button. I see 3 icons in the start menu but they only produce the java control panel. I also see a java icon in the documents folder - Java Setup 8u171.  Where is the jdk?  Am I supposed to unzip a file? Did I not download java at all? Talk about starting from zero.
 
Master Rancher
Posts: 4508
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are two downloads: JDK and JRE.  Sounds like you got the JRE.  If you want to compile java programs you need the JDK.

When installing the downloaded .exe file for the JDK, it will prompt you to chose the folder to install into.

in the documents folder - Java Setup 8u171.


Is that a file?  What extension does it have?  How big is it?
 
Ranch Hand
Posts: 69
IntelliJ IDE Eclipse IDE VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Frankie,
First, welcome to the Ranch.

Second, all you got, I think, is the JRE, Java Runtime Environment. I don't think java.com will get you to the JDK. Try this site:

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

(Which I know works, because I was just there.)

Have a great night,
Doug
 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is important to note that Windows 10 does support Java. The issue Edge users encounter is the lack of plug-ins support by Edge.  By “lack of plug-ins support,” we mean there is simply no way to activate or enable the Java plug-in with the Edge web browser. Period. If Windows 10 supports Java, but the Edge browser does not, the question about how to use Java on Windows 10 remains.
 
Norm Radder
Master Rancher
Posts: 4508
38
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

 question about how to use Java on Windows 10 remains.


There are no questions about Java on  WIndows 10.  If you are referring to java applets, most modern browsers do not support them.
 
Frankie Bailey
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


OK - I had only downloaded the JRE.  I went and downloaded the JDK.  I have both but I understand the JDK includes the JRE. What next? How do I get to a place to run a java program?

I know how to use the command line in the dos window. Would that be the only way to execute a java program unless I have an IDE?

Also, what is the purpose of the JRE?  I must be sounding like a head without brains here.

Thanks for the responses - every little bit helps.
 
Saloon Keeper
Posts: 24564
168
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The JRE is the Java Runtime Environment. That is the virtual machine and core classes needed to run a compiled Java application.

The JDK is the Java Developer's Kit. It contains the compiler and development tools. It also contains a JRE because A) a lot of the system is itself written in Java and therefore needs a JVM environment to run it and B) it's no fun having a useless compiled program. Why do 2 downloads if you can do one? Although if you're not careful, some of the Oracle downloads also bundle in crapware that you may not want or need at all, so choose carefully!

Java is invoked via the command line. The "java" command launches a JVM, the "javac" command runs the Java compiler and the "jar" command is a ZIP-like program for creating and working with Java ARchives. Just to name a few.

To run these apps, which are all native apps (or at least they're launched as native apps), you need the JDK bin directory in your command shell PATH just like you would for any other DOS application. Or simply type the program's executable filepath directly. For example "C:\Program Files\java\jdk1.8.x\bin\java". Please note the quotes required because "Program Files" has a space in the filename. And, of course, the actual directory path will be related to where you installed the JDK. Speaking of which, Java is not like Internet Explorer. You can have multiple versions of JREs and JDKs installed and running on the same OS at the same time.
 
Norm Radder
Master Rancher
Posts: 4508
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

 way to execute a java program


There are several choices on how to execute a java program:
manually enter the java <TheClassNameHere> in a command prompt in the directory that holds <TheClassNameHere>.class file
Create a batch file with the java command in it.
Create a jar file that contains the needed class files and a manifest file that refers to the class with the main() method
Create a shortcut with a target of the folder with the .class files and the command to execute the java command
Define your own file extension, add an entry to the registry for that extension and add an entry to execute a commandline with the java command, your class and a reference to the file that was opened.
 
Ranch Hand
Posts: 235
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Frankie Bailey wrote:

OK - I had only downloaded the JRE.  I went and downloaded the JDK.  I have both but I understand the JDK includes the JRE. What next? How do I get to a place to run a java program?

I know how to use the command line in the dos window. Would that be the only way to execute a java program unless I have an IDE?

Also, what is the purpose of the JRE?  I must be sounding like a head without brains here.

Thanks for the responses - every little bit helps.




I see others have answered the what is the JRE question.

It is recommended that you first learn Java using the command line, and holding off on an IDE.  IDEs, while convenient, have been found to hide certain functional matters (how to handle packages comes to mind).  Using the command line will give you the skills needed that an IDE will hide and it will make you a better programmer.

As to what to do next, and where to get started, I suggest The Java Tutorials.  Remember, the best way to start your project is to turn off your computer, find a pad and pencil, and write down what it is you want to accomplish.  Keep at this until you have a good understanding of what your requirements will be.  Doing this will help you plan out what objects you will need, and will make actual coding much easier.  This simple method will reduce the number of times you will start over from scratch, throwing away classes, rewriting the same class multiple times, all that fun stuff.

Good luck.  Ask lots of questions.  Let us know when you have solved a problem you have asked here at the ranch for advice.

Regards,
Robert
 
Marshal
Posts: 74378
334
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Frankie Bailey wrote:. . . Also, what is the purpose of the JRE? . . . .

It is for people who want to run Java® code but don't need to develop their own. You are obviously developing your own, so you need a JDK.

And  . . . welcome to the Ranch
 
Frankie Bailey
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


First  - thanks to you all.

I downloaded a file. On windows it is:  jdk-10.0.1_windows-x64_bin (390 MB). In the Windows Power Shell it is: jdk-10.0.1_windows-x64_bin.exe.

Is this the JDK installer or is it the JDK itself?

I have read much of the text on the java and oracle sites and my understanding gets no better.
Assuming it was the installer, I clicked and  an alert that said this software is already installed on this computer.

Where is it?

If I am at the dos window or the Windows Power shell - where do I navigate to find the java compiler? And issue the run command?  How can I produce a path if I don't know where this stuff is? Or even if I have it?
 
Ranch Hand
Posts: 47
1
IntelliJ IDE Slackware Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Frankie, take a look in C:\Program Files\Java\
I believe that is the default installation directory on Windows. In there you should find your jdk-10.0.1 installation.
As for the PATH environment variable, it's done automatically when you installed Java, so assuming it's installed, you should be able to use java/javac/jar from the command line in any directory.
 
Campbell Ritchie
Marshal
Posts: 74378
334
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Eric Arnold wrote:Frankie, take a look in C:\Program Files\Java\
I believe that is the default installation directory on Windows. In there you should find your jdk-10.0.1 installation.

Only after you have installed Java®. I am by no means certain, but I believe that Java® hasn't been installed on Windows® by default for quite a long time.

As for the PATH environment variable, it's done automatically when you installed Java, . . .

I am afraid that isn't correct; you have to edit the PATH yourself.
 
Robert D. Smith
Ranch Hand
Posts: 235
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Eric Arnold wrote:Frankie, take a look in C:\Program Files\Java\
I believe that is the default installation directory on Windows. In there you should find your jdk-10.0.1 installation.
As for the PATH environment variable, it's done automatically when you installed Java, so assuming it's installed, you should be able to use java/javac/jar from the command line in any directory.


This is partially correct.  The Oracle installer will set a path to C:\Program Files (x86)\Common Files\Oracle\Java\javapath which contains the java and javaw executeables.  The path to the jdk is not set.  (New laptop, fresh installs of everything), and will need to be set through the control panel.

Frankie -- there are plenty of tutorials and how-tos to set the path.  Several even contain step by step pictures.  Since you have installed java 10, assuming you took the default install directory, you will find java installation at C:\Program Files\Java\jdk-10.0.1\bin

Normally, I would post the step by step here; but, given your level of experience I strongly suggest you google something along the lines of windows 10 set environment variables.  

Good luck, have fun and ask lots of questions.

Regards,
Robert
 
Eric Arnold
Ranch Hand
Posts: 47
1
IntelliJ IDE Slackware Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Aye, sorry for the confusion. I meant that when you install Java on Windows, the default installtion directory is C:\Program Files\Java\
Although I was mistaken about the PATH env variable, you do need to configure it youself. Oracle provides a bice doc explaining this process here.
https://www.java.com/en/download/help/path.xml
 
Norm Radder
Master Rancher
Posts: 4508
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

On windows it is:  jdk-10.0.1_windows-x64_bin (390 MB).


Is that from the File Explorer program?  You should change the options for File Explorer so that it displays a file's extension.  It will be useful(a requirement?) to see a file's extension when programming.

I'm confused on how you can have installed any of the java programs without getting prompts from the installation programs asking where you want the programs to be installed.   Most of the java I've installed have asked me where to place the programs.  I have the JDKs on the D: drive and JREs on the C:
 
Campbell Ritchie
Marshal
Posts: 74378
334
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Norm Radder wrote:. . . prompts from the installation programs asking where you want the programs to be installed.   Most of the java I've installed have asked me where to place the programs. . . .

That is indeed what happens; when I try installing Java® on Windows®, it shows a default location and gives me the option to install Java® elsewhere. But I have always let it use the default location.
 
Frankie Bailey
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


We have some huge progress.

I deleted all files with java reference and started over.

I downloaded the JDK and this time the WIZARD guided the installation. I can see everything on Windows at :

This PC > Windows(C:) > Program Files > Java > jdk-10.0.1 > bin

BUT -  I cannot get to this folder with a  DOS command. I've tried many combinations.  So, say I'm sitting at the prompt C:\ - what next?


Many years ago, at the the turn of the century, I took a class in Java programming from the local community college. At that same time, I was teaching myself to build web sites.
I built my first web site to display Java applets from class assignments. The applets cannot be seen anymore with any of the modern  browsers. I thought if I could install Java on my
computer, I could execute them and see them again. Also I read that a plugin could be installed in some browsers?



 
Norm Radder
Master Rancher
Posts: 4508
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

 I cannot get to this folder with a  DOS command


There is no need to get to the bin folder with a DOS command window.  In fact you do not want to write any files into the installed folders.
Create your own folder(s) to hold your java projects.  

To get access to the javac command, you can tell the OS where it is located by adding an entry to the environment variable: PATH
or you can use the full path to javac.exe when executing it, for example in a batch file.
Here is the commandline I use to compile:
C:\Program Files\Java\jdk1.8.0_60\bin\javac.exe -cp . -Xlint -Xdiags:verbose TestCode24.java


applets cannot be seen anymore with any of the modern  browsers.


I've been able to execute applets using Internet Explorer 11.  It may require adding entries to the java exceptions list
Also the AppletViewer that comes with the JDK works.
 
Sheriff
Posts: 7111
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is a Wiki that explains all of this:

https://coderanch.com/wiki/659740/create-Java-program
 
Frankie Bailey
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Total Success.

I was able to see the applets with the appletviewer in the dos window.

I'll look into Internet Explorer 11 etc...

I'll end this thread now. I'll probably need a new one soon. Thanks for all the input.

Window does not accept directory name Program Files - must put in quotes "Program Files" because of its length.
 
Norm Radder
Master Rancher
Posts: 4508
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

must put in quotes "Program Files" because of its ...

embedded spaces.  The parser for the path to the command stops at the first space (unless in quotes)
 
reply
    Bookmark Topic Watch Topic
  • New Topic