This week's book giveaways are in the Jython/Python and Object-Oriented programming forums.
We're giving away four copies each of Machine Learning for Business: Using Amazon SageMaker and Jupyter and Object Design Style Guide and have the authors on-line!
See this thread and this one for details.
Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

Solving a complex programming problem

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

How to solve below complex problem using java  and what program code should be written with minimum lines of code to solve it and which java software should be downloaded which should support basic java programming to most complex and latest java programming and it should be available free to download from internet?

below is the problem :-

Chef's ingredients:-


1.The chef receives exactly 1 ingredient per day from the market.The
ingredients never repeat.

2. Every ingredient belongs to 1 of the 3 categories namely FIBER,FAT & CARB.

3.Every ingredient has a unique ingredient id.

4.The ingredient id always starts with the category name (ex:FIBERBroccoli,FATCheese,CARBRice)

Chef's Dishes

1. All of the chef's dishes have a constant number of ingredients.(this will be your program's input)

2. All the ingredients used will be fully used in a Dish. The chef doesn' use some part/quntity of an ingredient.

3.All of the chef's dishes mush have at least 60% of the ingredients from a single category.(i.e. if the chef cooks using
4 ingredients,then at leaast 3 FAT ingredients OR at least 3 FIBER ingredients OR at least 3 CARB ingredients are needed)


Chef's Cooking style:-

1. If the chef has multiple options of ingredients for the dish,then he takes the oldest possible ones to cook
in the order of their arrival.

2.After the chef prepares a dish,the ingredients used can Not be reused as theyhave been already used.

3.The chef prepares a maximum of 1 dish per day.

4.if the Chef does not have enough ingredients to cook the dish with above mentioned rules,then he does not
cook on that day.

Given the input array of ingredient id that the chef receives every day (i.e. array index is the day number)
write a program to print when does the chef cook a dish and when he does not.


Input:-

Line 1: The total number of days for the scope of the problem(1<=input<=20)

Line 2: The exact number of ingredients that chef uses to cook(1<=input<=20)

Line 3: The space separated ingredient ids.(6<=length(ingredientid)<=20)

Output:- Print the ":" separated used ingredient ids in order of their arrival if the chef cooks on that day
and print "-" if the chef doesn't cook anything on that day.Print the output as  single string.

Example input 1:

5
3
FATOil FATCheese FATEgg FIBERSpinach CARBRice FIBERBeans

Example INPUT 2:

6
3
FATOil:FATCheese FATEgg FIBERSpinach CARBRice FIBERBeans

EXAMPLE OUTPUT 2:

--FATOil:FATCheese:FATEgg--FIBERSpinach:CARBRice:FIBERBeans

EXAMPLE INPUT 3:

12
4
FATOil FIBERSpinach CARBRice FATCheese FIBERBeans FATEgg
FIBERBroccoil CARBPotato CARBCorn FATOlive FIBERCarrot




Thanks



 
Saloon Keeper
Posts: 6066
154
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

How to solve below complex problem using java  and what program code should be written with minimum lines of code to solve it and which java software should be downloaded which should support basic java programming to most complex and latest java programming and it should be available free to download from internet?


I don't quite follow this. The programming exercise seems quite detailed, but your question sounds like you have never done Java programming before? Or have you just never installed Java on a computer? If the latter, you can get a JDK from https://adoptopenjdk.net/. If you're stumped by the options, choose Java 11 and HotSpot.

As to the problem at hand, you're presumably taking a course that should have prepared you for this kind of exercise. Do you have specific questions about the problem? Those might be best addressed to your teacher, but we can try to help.
 
John Ken
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
specific problem in this problem is like as followings:-

the program has to read inputs from standard input
the program has to write the solution to standard output

and output for all these 5 cases should be like as followings:-

the program has to read inputs from standard input
the program has to write the solution to standard output



for 1st case output should be like :- ---FATOil:FIBERSpinach:FATCheese-
2nd:---FATOil:FATCheese:FATEgg--FIBERSpinach:CARBRice:FIBERBeans
3rd:-12
4
FATOil FIBERSpinach CARBRice FATCheese FIBERBeans FATEgg FIBERBroccoli CARBPotato CARBCorn FATOlive FIBERCarrot CARBBeetroot
4th:-

-----FIBERBroccoli:CARBRice:CARBOat:CARBCorn-FATEgg:FATCoconut:FIBERBeans:FATCheese-----FATSalmon:FIBERCarrot:FIBERSpinach:FIBERPumpkin---CARBQuinoa:CARBPotato:FATOil:CARBWheat

5h :-

18
5
FIBERBroccoli FATEgg FIBERPumpkin FATOil CARBPotato FATSalmon CARBWheat FATCheese FIBERSpinach CARBQuinoa CARBOat FATOlive CARBCorn FIBERCarrot CARBRice FATCoconut FIBERBeans FIBERBarley

and below is the code which needs to be completed for all these 5 test cases:-

also i have windows 7 32bit operating system so there is no option after selecting 11 and hotspot for 32bit windows 7 operating system so not sure how can i solve or write code to fulfill all these very tough 5 test cases so that i could achieve desired outputs for all these 5 test cases.

 
Ranch Foreman
Posts: 76
9
Firefox Browser MySQL Database Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That code isn't Java code. I'm not sure, but it looks like C# or C++ (I know nothing about either)
 
Marshal
Posts: 67464
257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If it uses cin >> it is C++. I shall move you to that forum. I shall also add code tags (please always use them: there is even a C++ option), and you can see how much better your code will look I don't understand the bit about version 11.

And welcome to the Ranch
 
Campbell Ritchie
Marshal
Posts: 67464
257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you want a Java® development kit, try this link for an “i586” download of Java8. The same website goes back to Java7. Java9+ downloads seem to be available only for 64‑bit machines.
 
John Ken
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the link which you have shared lands up downloading some zip file called openjdk-8u41-b04..zip so what should i do after downloading it how can i start writing simple java program from this zip file also will this zip file suport advanced complex java programs also which if i write or work in some time or will it fail as my system is on Windows 7 and on 32 bit ?
 
Campbell Ritchie
Marshal
Posts: 67464
257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try our FAQ, or this download link and these instructions. Make sure to update your system PATH and not to create a CLASSPATH.
 
John Ken
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
these links point to 64 bit whereas i have 32 bit windows 7 Operating system considering this which latest Java should support my system?
 
Tim Moores
Saloon Keeper
Posts: 6066
154
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How is the C code you posted related to your asking about Java?
 
John Ken
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
as both are object oriented languages only syntx might be different but base logic to sort out this problem should be common right?
 
Tim Moores
Saloon Keeper
Posts: 6066
154
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not just they syntax differs between C++ and Java, but also the semantics. But anyway, the code you posted contains no logic. Is that all you have so far? Have you done any Java programming at all?
 
Campbell Ritchie
Marshal
Posts: 67464
257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The link I posted contains a download link for Java8u241 for Windows® on i586. That is a 32‑bit implementation.
 
Bartender
Posts: 2472
108
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to coderanch !! This is an interesting problem. I would like to you first have a look at these links first about our forum rules : QuoteYourSources and this : NotACodeMill.

While you work out how to get Java to run on your machine, can you share the details about your thought process in Pseudo code ?

The way I would visualize your problem, e.g. in scenario one:
We have 5 days to prepare a meal having 3 ingredients. Parsing our text ( FATOil FATCheese FATEgg FIBERSpinach CARBRice FIBERBeans), we need to somehow group it as What would be your plan to make a selection from the above table to cover the 60% criteria ?
 
John Ken
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

salvin francis wrote:Welcome to coderanch !! This is an interesting problem. I would like to you first have a look at these links first about our forum rules : QuoteYourSources and this : NotACodeMill.

While you work out how to get Java to run on your machine, can you share the details about your thought process in Pseudo code ?

The way I would visualize your problem, e.g. in scenario one:
We have 5 days to prepare a meal having 3 ingredients. Parsing our text ( FATOil FATCheese FATEgg FIBERSpinach CARBRice FIBERBeans), we need to somehow group it as What would be your plan to make a selection from the above table to cover the 60% criteria ?




I am not sure I am interpreting this correctly.  What I am reading is the following:



a.                    program is going to prompt for input 3 times

Input 1: Specify the number of days the chef will be going to market
Input 2: Specify how many ingredients the chef will need for a dish
Input 3: A list of the ingredients, one for each day, in format CATEGORY-IngredientName, separated by a space
b.                   Rules for the input:

Ingredient names may not repeat
Chef will only pick up one ingredient per day (hence number of entries on input #3 must match what you added in input #1)
At least 60% of dishes must be from the same category
c.                   Output

For each day, print what ingredients a dish will have per day.  However, if there are not enough ingredients to satisfy the dish, mark the day with a –




If we look at example #1 given:



Example input 1:

5
3
FATOil FATCheese FATEgg FIBERSpinach CARBRice FIBERBeans


for 1st case output should be like :- ---FATOil:FIBERSpinach:FATCheese-



So here, the Chef will go 5 time to the market, he will need 3 ingredients for a dish.  The 5 ingredients listed are FATOil FATCheese FATEgg FIBERSpinach CARBRice (FIBERBeans would not be picked up if the input was 5 days).

For the first day, no dish, output is –
For the 2nd day, no dish, output is –
For the 3rd day, no dish, as all 3 items up to day 3 were from the same category (not sure if this is supposed to be a rule)
For the 4th day, the output for the dish will be FATOil, FATCHEESE and FIBERSpinach
For the 5th day, no dish as there are no ingredients available to satisfy the 3-ingredient requirement


Program flow, I am a bit hazy on this, but suggest something like this



Take input, and check if it matches the input criteria (1<=input<=20)
Once we receiv input from all three lines, do the following, for each day (as specified on input 1)
Loop number of days
                                                              i.      Check if the ingredients match the rules.  we will have to check the rules one-by-one for this

                                                            ii.      If all the rules have passed, we can print it for the day

                                                          iii.      If the rules have failed, print a dash –

Loop again
 
John Ken
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

salvin francis wrote:Welcome to coderanch !! This is an interesting problem. I would like to you first have a look at these links first about our forum rules : QuoteYourSources and this : NotACodeMill.

While you work out how to get Java to run on your machine, can you share the details about your thought process in Pseudo code ?

The way I would visualize your problem, e.g. in scenario one:
We have 5 days to prepare a meal having 3 ingredients. Parsing our text ( FATOil FATCheese FATEgg FIBERSpinach CARBRice FIBERBeans), we need to somehow group it as What would be your plan to make a selection from the above table to cover the 60% criteria ?




Windows

Double-click the file you have downloaded.
Follow the installer instructions. You don't need to change the default options. You may just change the directory where you want to install the JDK. After the installation is over, make sure that the directory you have chosen has been created.

after i downloaded from the link you mentioned for windows 7 OS(32 Bit)
this file was downloaded in my c drive atomatically :-openjdk-8u41-b04-windows-i586-14_jan_2020 (2).zip - ZIP archive, unpacked size 187,695,172 bytes
what should i do now?
 
Campbell Ritchie
Marshal
Posts: 67464
257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Start by unzipping it and finding out what it contains. Look for Java8 installation instructions. I haven't got the time too write any more just now, sorry.
 
John Ken
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Start by unzipping it and finding out what it contains. Look for Java8 installation instructions. I haven't got the time too write any more just now, sorry.



there are not any installation instructions for java8 inside these zip files.there are many folders and subfolders inside this zip files in which folder exactly i should search also where is setup .exe file to install java on my system,can some java expert please advise soon?


also any updates regarding that complex problem?
 
John Ken
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
any updates by experts please neither i have been able to install latest java for my windows 7 32 bit nor solve this problem is there really any expert vailable who could really help me and make things work for me however i have been trying my best to solve both these problems but unfortunately unable to get right direction or help from this forum so fat despite following up multiple times.
 
Campbell Ritchie
Marshal
Posts: 67464
257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry for delay; I have never installed a .zip on Windows® (the corresponding files simply need to be unzipped in the appropriate location on a Linux box). Try this openJDK link. That had a 32 bit implementation for Java7. The Java8 download appears to be fo Win10 only. Later downloads appear to be 64 bit only.
[edit] What happens if you unzip the file you already have, and add its location to the PATH? If it doesn't work, you can simply delete the file and the PATH entry. A PATH entry usually starts with the drive letter and ends bin: C:\...\...\bin
 
Saloon Keeper
Posts: 11189
244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A zip will work just fine. It's what I have for the OpenJDK kit.

Just unpack the ZIP somewhere and then set your environment variables. Assuming you unpacked Java to C:\Program Files\Java\jdk1.8.0_241,

  • set JAVA_HOME to C:\Program Files\Java\jdk1.8.0_241
  • prepend PATH with %JAVA_HOME%\bin;

  • Now start CMD and run 'java -version'.

    You will also want to use Maven at some point. Get it here. Assuming you unpacked Maven to C:\Program Files\Apache\Maven 3.6.3,

  • set M2_HOME to C:\Program Files\Apache\Maven 3.6.3
  • set M2 to %M2_HOME%\bin
  • prepend PATH with %M2%;

  • Restart CMD and run 'mvn -v'.
     
    John Ken
    Ranch Hand
    Posts: 53
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Stephan van Hulst wrote:A zip will work just fine. It's what I have for the OpenJDK kit.

    Just unpack the ZIP somewhere and then set your environment variables. Assuming you unpacked Java to C:\Program Files\Java\jdk1.8.0_241,

  • set JAVA_HOME to C:\Program Files\Java\jdk1.8.0_241
  • prepend PATH with %JAVA_HOME%\bin;

  • Now start CMD and run 'java -version'.

    You will also want to use Maven at some point. Get it here. Assuming you unpacked Maven to C:\Program Files\Apache\Maven 3.6.3,

  • set M2_HOME to C:\Program Files\Apache\Maven 3.6.3
  • set M2 to %M2_HOME%\bin
  • prepend PATH with %M2%;

  • Restart CMD and run 'mvn -v'.



    I have downloaded it in my F drive but not sure how to do below :-

    set JAVA_HOME to C:\Program Files\Java\jdk1.8.0_241
    prepend PATH with %JAVA_HOME%\bin;
     
    Stephan van Hulst
    Saloon Keeper
    Posts: 11189
    244
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
  • Press Windows key + Pause/Break key.
  • Click "Advanced sysem settings" on the panel on the left.
  • Click "Environment Variables...".
  • Click "New..." under "User variables" to add the JAVA_HOME, M2_HOME and M2 environment variables.
  • Click "Edit..." under "User variables" to edit the PATH environment variable.

  • When I say you need to prepend something to the PATH environment variable, it means you need to add it in front of what's already configured there. Make sure to separate paths with a semi-colon.
     
    John Ken
    Ranch Hand
    Posts: 53
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    i gave variable name JAVA_HOME
    and value i gave it as a '%JAVA_HOME%\binF:\Java Training\SW'
    because after downloading this java software i have kept it in this location :- F:\Java Training\SW
    please refer the screen shot attached with this post for more clarity and please let me know i have correctly preponed as you have advised or there is some mistake in it?

    also why are you asking me to download maven where as i just want to be java expert not maven expert what roles maven will play to help me become java expert?
    even when i am trying to download from the link which you have underlined it's pointing towrads again multiple links so considering i have windows 7 32 bit installed on my system which exact link should i refer to?

    Thanks
    I have downloaded it in my F drive but not sure how to do below :-

    set JAVA_HOME to C:\Program Files\Java\jdk1.8.0_241
    prepend PATH with %JAVA_HOME%\bin;

    Env.-Variable.png
    [Thumbnail for Env.-Variable.png]
     
    Campbell Ritchie
    Marshal
    Posts: 67464
    257
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    John Ken wrote:. . . value i gave it as a '%JAVA_HOME%\binF:\Java Training\SW' . . .

    That sounds incorrect. Your JAVA_HOME environment variable should read "F:\Java Training\SW" with quotes. I don't know whether you need 'quotes' or "quotes"; I have only seen "quotes".
    You edit your PATH, as Stephan has told you, by adding %JAVA_HOME%\bin; to its start. If you add an incorrect PATH component, you probably won't notice that anything is wrong. The OS will try that PATH entry, find nothing useful, and ignore it.

    [addition]Don't set a user JAVA_HOME and try to use it in a system PATH.
     
    Stephan van Hulst
    Saloon Keeper
    Posts: 11189
    244
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    You don't need to use any quotes at all. It will work fine without quotes, even if there are spaces in the paths.

    John, Campbell explained what you did wrong. Please read the instruction again carefully.

    As for Maven, you don't need it now and you can learn lots of Java without it. You will want to use it eventually once your projects start becoming more complex. I'm of the strong opinion that if you don't know Maven, you can't be called a Java expert.
     
    Campbell Ritchie
    Marshal
    Posts: 67464
    257
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Stephan van Hulst wrote:You don't need to use any quotes . . .

    Thank you
     
    John Ken
    Ranch Hand
    Posts: 53
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Stephan van Hulst wrote:You don't need to use any quotes at all. It will work fine without quotes, even if there are spaces in the paths.

    John, Campbell explained what you did wrong. Please read the instruction again carefully.

    As for Maven, you don't need it now and you can learn lots of Java without it. You will want to use it eventually once your projects start becoming more complex. I'm of the strong opinion that if you don't know Maven, you can't be called a Java expert.

    system variable

    Ok,for installing java when i used a new system variable Java_Home

    and assigned it the value as shown in attached screen shot and then ran java -version commnd on command prompt then again i am getting this error
    as attached in scren shot 'java is not recognized as an internal or external command ...'.
    Env.-Variable-System.png
    [Thumbnail for Env.-Variable-System.png]
    command-prompt-error.png
    [Thumbnail for command-prompt-error.png]
     
    Campbell Ritchie
    Marshal
    Posts: 67464
    257
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    John Ken wrote:. . . and assigned it the value as shown in attached screen shot . . .

    I have already told you that looked incorrect
     
    Stephan van Hulst
    Saloon Keeper
    Posts: 11189
    244
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Stephan van Hulst wrote:Just unpack the ZIP somewhere and then set your environment variables. Assuming you unpacked Java to C:\Program Files\Java\jdk1.8.0_241,

  • set JAVA_HOME to C:\Program Files\Java\jdk1.8.0_241
  • prepend PATH with %JAVA_HOME%\bin;

  • Follow these instructions carefully, but use the folder you unpacked Java to instead of the example I used here.

    Also, don't create system variables. Create user variables. And don't edit the system PATH variable. Edit the user PATH variable.
     
    John Ken
    Ranch Hand
    Posts: 53
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Stephan van Hulst wrote:

    Stephan van Hulst wrote:Just unpack the ZIP somewhere and then set your environment variables. Assuming you unpacked Java to C:\Program Files\Java\jdk1.8.0_241,

  • set JAVA_HOME to C:\Program Files\Java\jdk1.8.0_241
  • prepend PATH with %JAVA_HOME%\bin;

  • Follow these instructions carefully, but use the folder you unpacked Java to instead of the example I used here.

    Also, don't create system variables. Create user variables. And don't edit the system PATH variable. Edit the user PATH variable.



    As I have kept it in this location:-F:\Java Training\SW

    so as advised i have created new user variable with name Java_Home

    and assigned the value to it like as advised :
    JAVA_HOME.png
    [Thumbnail for JAVA_HOME.png]
     
    John Ken
    Ranch Hand
    Posts: 53
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Still after assigning the advised value to JAVA_HOME User variable as :- %JAVA_HOME%\bin;F:\Java Training\SW

    when on cmd prompt running java -version getting same error as attached in previous post.

    not sure what is wrong here again.
     
    Stephan van Hulst
    Saloon Keeper
    Posts: 11189
    244
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    You did not follow the instructions correctly. Why does it read %JAVA_HOME%\bin;F:\Java Training\SW and not just F:\Java Training\SW?
     
    John Ken
    Ranch Hand
    Posts: 53
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Stephan van Hulst wrote:You did not follow the instructions correctly. Why does it read %JAVA_HOME%\bin;F:\Java Training\SW and not just F:\Java Training\SW?



    i did it because i was advised by someone on this forum to prepend %JAVA_HOME%\bin before F:\Java Training\SW by inserting one semicolon (;)
    also if it has to be removed then also i tried by removing it and just giving the value to JVA_HOME Variable to F:\Java Training\SW and then again teste cmd and ran java version and again it ended up in same error.
     
    Stephan van Hulst
    Saloon Keeper
    Posts: 11189
    244
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    The second part of the instruction says to prepend %JAVA_HOME%\bin; to the PATH environment variable. Not the JAVA_HOME environment variable.

    When you have fixed that, you need to restart your command prompt before it will pick up the changes.
     
    Marshal
    Posts: 6643
    177
    Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Take a look at this Wiki:

    https://coderanch.com/wiki/659740/create-Java-program

    It may clear some things up for you.
     
    John Ken
    Ranch Hand
    Posts: 53
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Stephan van Hulst wrote:The second part of the instruction says to prepend %JAVA_HOME%\bin; to the PATH environment variable. Not the JAVA_HOME environment variable.

    When you have fixed that, you need to restart your command prompt before it will pick up the changes.



    even i restated command prompt and reran java -version commd it gives same error secondly where is that PATH variable in which i need to prepend '%JAVA_HOME%bin; to the PATH environment variable.
     
    Stephan van Hulst
    Saloon Keeper
    Posts: 11189
    244
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    If it does not exist under user variables, create it.
     
    John Ken
    Ranch Hand
    Posts: 53
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    Stephan van Hulst wrote:If it does not exist under user variables, create it.



    even after creating new path variable in user as shown in attached screenshot same error for java -version command.

    PATH.png
    [Thumbnail for PATH.png]
     
    Stephan van Hulst
    Saloon Keeper
    Posts: 11189
    244
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Did you close the environment variables window when you were done? Did you restart the command prompt afterward?

    Please show us the content of the SW folder.
     
    We can fix it! We just need some baling wire, some WD-40, a bit of duct tape and this tiny ad:
    Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps
    https://coderanch.com/t/722574/Sauce-Labs-World-Largest-Continuous
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!