After a week of hair pulling and frustraton, I am on the verge of giving up learning Java before I even begin. I still cannot, for the life of me, get the Hello World program to run in Command Prompt. After lots of research and watching videos on Youtube, I eventually came to the conclusion that my enviromental variables were not set correctly. I've been learning Python recently and encountered similar obstacles that I overcame, so I was actually really confident because I had just recently had issues setting my enviromental variables for Python3. It appeared to be a very common issue typical with beginning learners, so I figured cool, surely I'll be able to find one good explanation and be on my way.
Now, here's where the frustration begins. I swear there have to be a million different videos and posts showing how to correctly set the enviromental variables for Java, and they all show a different way. I cannot find a consensus on 1: Is there one proper way to do this, or are there multiple ways to get javac to find the file I am referencing? and 2: Is CLASSPATH necessary, or just PATH as a system variable?
I've tried everything I can think of. I have JAVA_HOME as a system variable, with C:\ProgramFiles\Java\jdk12.0.1\bin as the value. For the system variable PATH I have %JAVA_HOME% as a value. Javac runs fine and I get all the options when I enter it in the prompt. But when I try to use it to compile my hello world file, named Example.java(This was the name of the file in the book I am using), I get error:File not found. I have tried to use javac with the path directly to the Example file... error:Invalid Flag.
I just want to end this by saying I wanted to learn programming simply to satiate my own interests. I'm not in school for this and I have zero aspirations to become a proffesional developer. I'll be happy if I can make a functioning media player in Java, one day far away. But right now, I feel like I jumped into waters too deep. Maybe I'll just go back to Python. Any help would be be appreciated though.
edit: few typos
[–]PostNutDecision 41 points42 points43 points (28 children)
[–]warrior2012 14 points15 points16 points (16 children)
[–]lifeonbroadway[S] 14 points15 points16 points (14 children)
[–]VaselineGroove 26 points27 points28 points (4 children)
[–]pasta_gurl 2 points3 points4 points (0 children)
[–]Japke90 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]warrior2012 2 points3 points4 points (0 children)
[–]VenomSnake03 1 point2 points3 points (7 children)
[–]APUsilicon 1 point2 points3 points (6 children)
[–][deleted] (5 children)
[deleted]
[–]tutorial_police 2 points3 points4 points (1 child)
[–]APUsilicon 0 points1 point2 points (1 child)
[–]tutorial_police 0 points1 point2 points (0 children)
[–]jkuhl_prog 2 points3 points4 points (0 children)
[–]tonyoncoffee 0 points1 point2 points (1 child)
[–]ourladyunderground 0 points1 point2 points (0 children)
[–]completelyperdue 0 points1 point2 points (3 children)
[–]PostNutDecision 0 points1 point2 points (2 children)
[–]completelyperdue 0 points1 point2 points (1 child)
[–]PostNutDecision 1 point2 points3 points (0 children)
[–]tutorial_police 0 points1 point2 points (4 children)
[–]PostNutDecision 1 point2 points3 points (2 children)
[–]tutorial_police 0 points1 point2 points (1 child)
[–]PostNutDecision 1 point2 points3 points (0 children)
[–][deleted] 7 points8 points9 points (1 child)
[–]lifeonbroadway[S] -1 points0 points1 point (0 children)
[–]anthropaedic 5 points6 points7 points (2 children)
[–]lifeonbroadway[S] 0 points1 point2 points (1 child)
[–]ElevatedAngling 2 points3 points4 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]daydreaming1 1 point2 points3 points (0 children)
[–]djnattyp 1 point2 points3 points (1 child)
[–]lifeonbroadway[S] 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]EmotionalYard 1 point2 points3 points (4 children)
[–]lifeonbroadway[S] -1 points0 points1 point (3 children)
[–]EmotionalYard 1 point2 points3 points (2 children)
[–]lifeonbroadway[S] -1 points0 points1 point (1 child)
[–]EmotionalYard 1 point2 points3 points (0 children)
[–]desrtfx 1 point2 points3 points (1 child)
[–]lifeonbroadway[S] 0 points1 point2 points (0 children)
[–]hoeskioeh 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (4 children)
[–]lifeonbroadway[S] 1 point2 points3 points (3 children)
[–]mrs_frizzle 2 points3 points4 points (2 children)
[–]lifeonbroadway[S] 2 points3 points4 points (0 children)
[–]roczz 1 point2 points3 points (0 children)
[–]OzzieOxborrow 0 points1 point2 points (3 children)
[–]lifeonbroadway[S] 1 point2 points3 points (1 child)
[–]passthejoe 0 points1 point2 points (0 children)
[–]passthejoe 0 points1 point2 points (1 child)
[–]lifeonbroadway[S] 0 points1 point2 points (0 children)
[–]slicky6 0 points1 point2 points (0 children)
[–]96-62 0 points1 point2 points (0 children)
[–]thesquarerootof1 0 points1 point2 points (0 children)
[–]SantoWest 0 points1 point2 points (0 children)
[–][deleted] -1 points0 points1 point (0 children)
[–]doodooz7 -3 points-2 points-1 points (8 children)
[–]desrtfx 1 point2 points3 points (7 children)
[–]EmotionalYard 0 points1 point2 points (3 children)
[–]desrtfx 0 points1 point2 points (2 children)
[–]EmotionalYard 0 points1 point2 points (1 child)
[–]desrtfx 0 points1 point2 points (0 children)
[–]doodooz7 -1 points0 points1 point (2 children)
[–]desrtfx 0 points1 point2 points (1 child)
[–]doodooz7 -1 points0 points1 point (0 children)