• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to compile/run

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Since I recently started learning Java, I'm compiling and running my programs with two batchfiles (because actually working from the command line is not optimal).

I need the compiling batch-file because the window closes so fast after compiling, I can't read the compiler errors (hence the pause!):

@echo off
fileName.java
pause


I need the running batch-file because just double-clicking my class file doesn't work:

@echo off
java fileName
pause


Although this works, it's a bit annoying that I have to change the batch-files everytime I want to compile or run another class...

I'm a bit hesitant though about downloading programming software without knowing what it actually can do...
I don't want to use a big "suite-like" program because the fun for me is not so much in making a big fancy program but in writing the code itself!

Therefore the question: is there another way/a program to do this?
What I could really use is just a code-editor with a compile and a run button and a frame to display compiling- (and yes, I'm a newbie, runtime-) errors (and without fancy extra's, options, etc.)
 
Ranch Hand
Posts: 151
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why don't you want to use the command line to compile and run? It really is the best way for newbies to learn.

There are a ton of IDEs out there that do exactly what you just described. Google them, try a few out, and see what you like and don't like.
 
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try Notepad++. I had long back written an article on how to compile and run java programs through Notepad++ (it was for simple programs, not the one with packages and all).

There should be some way to pass the class name/source file name as the arguments to the batch file- like we have in a shell script. You could try that.
 
Vincent Hendriks
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK. Good to know that stuff like that is around

I'll try and find something that works for me.

Thanks
 
Marshal
Posts: 79239
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are probably better off at a beginner's stage using the command line directly. Use Notepad++ as a text editor; it is really good for editing program text.
You never double-click a class file to run it.
 
reply
    Bookmark Topic Watch Topic
  • New Topic