• Post Reply Bookmark Topic Watch Topic
  • New Topic

Compiles and runs in BlueJ, but cannot execute with cmd, or online IDE  RSS feed

 
Martin Kašpar
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I am a total newcomer to java, I did this and I have no problem with running this program in BlueJ, but I tried to execute via cmd, or https://www.compilejava.net/ but there are still some errors, please help, I'd like to learn
Here's the code.

 
Dave Tolls
Ranch Foreman
Posts: 3061
37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What errors do you get when you compile on the command line?
Can you copy and paste them here?
 
Campbell Ritchie
Marshal
Posts: 56546
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

Your code executed first time when I tried it (JDK8u121). It would appear to solve quadratic equations. Use \u00b9 instead of ^2; it will look much better
Please explain what results you were expecting and what you actually saw. You need to give us the details of the errors before we can help. I tried the code on my terminal and the second result (−1.0) appears to be correct.
java Kvadrarovnice
Převeď rovnici do ax^2 + bx + c
Zadej x^2 (První člen)
4
Zadej x (Druhý člen
10
Zadej číslo (Třetí člen)
6
D je 4
Rovnice má dva kořeny
První kořen x1 je -9.75
Druhý kořen x2 je -10.25
[critchie@...]$ java Kvadrarovnice
Převeď rovnici do ax^2 + bx + c
Zadej x^2 (První člen)
1 2 1
Zadej x (Druhý člen
Zadej číslo (Třetí člen)
D je 0
Rovnice má jeden výsledek
Jediným řešením rovnice je -1.0
Don't use the online compiler. It is giving no such element exceptions. The reason is that you are trying to read from system.in and there isn't a system.in available to the online compiler.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!