Very New to Jave, need to do totals/subtotals
Hi, (I hope this is the right place)
I'm VERY new to Java (I mainly do wourk with php interfaces for MyAQL databases).
Up until now, there hasn't been anything I couldn't do with PHP that I needed to...
My boss recently requested subtotals/totals at various points on an input sheet. The sheet inputs numbers of people, so I'm not worried about rounding (The php already takes care of people trying to input parts of people....) or tax.
It's a rather large form (~144 lines) and the math is already in place to do the subtotaling (among other things) before entering the information into the database.
How would I go about writing script that would display sub totals, and recalculate them every time one of the boxes value's is modified?
Is this something javascript is designed to do? Is there a better language out there for this task?
I've found sites out there that have canned subtotal/total scripts, but I don't want something pre-made unless it comes with a detailed explaination of what everything does; if I'm going to maintain it, I have to understand it.
Thanks
Is this a web form? e.g. a html form with input fields?
You can add onchange or onblur events to your input fields to detect changes. Then you can use javascript to retrieve the values from the form and do the calculation.
-S
Similar Messages
-
i'm very new to java and i'm getting an error in my application. i took 4 applications that compiled and worked separatly and i tried to combine them into one application. i'm getting the error: unreported exception java.io.IOException; must be caught or declared to be thrown, in lines 73,78,83,88,120,146,149,152,155 in the and it points at the keyboard.readLine() but everything i've tried just gives me more errors. please help anything and everything will be greatly appreciated. here it is, sorry about format i dunno how to straighten it in here:
// ^ ^
// (0)(0) A Happy Piggy Application
// Problems: 2.6,2.8,2.9,2.12 (oo)
// An application finds the total number of hours, minutes, & seconds, finds the distance
// between two points, finds the volume and surface area of a sphere, and adds up the change
// in a jar. First, the total hours, minutes, and seconds problem.
import java.io.*;
import java.text.DecimalFormat;
import java.text.NumberFormat;
public class twoptsix
static BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.in));
static PrintWriter screen = new PrintWriter(System.out, true);
public static void main (String[] args) throws IOException
double hoursa, minutesa, secondsa;
String hours;
System.out.print ("Please enter a number of hours: ");
hours = keyboard.readLine();
hoursa = Double.parseDouble(hours); //asks programmer friendly user to enter hours
String minutes;
System.out.print ("Please enter a number of minutes: ");
minutes=keyboard.readLine();
minutesa = Double.parseDouble(minutes); //asks programmer friendly user to enter minutes
String seconds;
System.out.print ("Pretty please enter a number of seconds: ");
seconds = keyboard.readLine();
secondsa = Double.parseDouble(seconds); //asks programmer friendly user to enter seconds
double allseconds;
allseconds = (hoursa * 3600) + (minutesa * 60) + secondsa; //adds up all the seconds of the time entered
System.out.println ("You have: " + hours + " hours..."); //displays hours
System.out.println ("" + minutes + " minutes..."); //displays minutes
System.out.println ("and " + seconds + " seconds..."); //displays seconds
System.out.println ("to get whatever you need to done!"); //witty attempt at humor
System.out.println ("The total amount of seconds is: " + allseconds + " seconds."); //displays total seconds
// An application that finds the distance between two points when the points
// are given by the user.
double x1, x2, y1, y2, total, distance;
String xa;
System.out.print ("Please enter the 'x' coordinate of first point: ");
xa = keyboard.readLine();
x1 = Double.parseDouble(xa); //asks programmer friendly user to enter first x value
String ya;
System.out.print ("...also need the 'y' coordinate of first point: ");
ya = keyboard.readLine();
y1= Double.parseDouble(ya); //asks programmer friendly user to enter first y value
String xb;
System.out.print ("...and the 'x' coordinate of the second point: ");
xb = keyboard.readLine();
x2 = Double.parseDouble(xb); //asks programmer friendly user to enter second x value
String yb;
System.out.print ("...don't forget the 'y' coordinate of the second point: ");
yb = keyboard.readLine();
y2 = Double.parseDouble(yb); //asks programmer friendly user to enter second y value
total = Math.pow(x2 - x1, 2.0) + Math.pow(y2 - y1, 2.0); //squares the differences of values
distance = Math.sqrt(total); //finds the square root of the sum of the differences of the values
System.out.print ("E=mc^2...oh and,");
System.out.print ("the distance between point (" + xa +"," + ya +") and point("+
xb + "," + yb + ") is : " + distance);
// An application that takes the radius of a sphere and finds and prints
// the spheres volume and surface area.
double radius,volume,area;
String rad;
System.out.print("Please enter the radius of a sphere: ");
rad = keyboard.readLine();
radius = Double.parseDouble(rad); //asks programmer friendly user to enter the radius of a sphere
DecimalFormat fmt = new DecimalFormat ("0.####");
volume = ((4 * Math.PI * Math.pow(radius,3.0)) / 3) ;
System.out.println (" The sphere has a volume of:" + fmt.format(volume)); //finds and displays volume
area = ( 4 * Math.PI * Math.pow(radius, 2.0)) ;
System.out.print (" The Surface Area of the sphere is: " + fmt.format(area)); //finds and displays surface area
// An application that finds the total, in dollars and cents, of a number of quarters,
// nickels, dimes, and pennies in your piggy bank.
int pennies, nickels, dimes, quarters;
double money1;
screen.println("Empty your piggy bank and count the change, how many quarters ya have?: ");
int q = (new Integer(keyboard.readLine())).intValue();//asks programmer friendly user to enter a number of quarters
screen.println("How many dimes?: ");
int d = (new Integer(keyboard.readLine())).intValue();//asks programmer friendly user to enter a number of dimes
screen.println("How many nickels?: ");
int n = (new Integer(keyboard.readLine())).intValue();//asks programmer friendly user to enter a number of nickels
screen.println("How many pennies?: ");
int p = (new Integer(keyboard.readLine())).intValue();//asks programmer friendly user to enter a number of pennies
NumberFormat money = NumberFormat.getCurrencyInstance();
money1 = (.25 * q) + (.1 * d) + (.05 * n) + (.01 * p);
screen.println("You're rich! Total, you've got: " + money.format(money1));//finds and displays total moneyOk here is the working code as one long function:
// ^ ^
// (0)(0) A Happy Piggy Application
// Problems: 2.6,2.8,2.9,2.12 (oo)
// An application finds the total number of hours, minutes, & seconds, finds the distance
// between two points, finds the volume and surface area of a sphere, and adds up the change
// in a jar. First, the total hours, minutes, and seconds problem.
import java.io.*;
import java.text.DecimalFormat;
import java.text.NumberFormat;
public class twoptsix
static BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.in));
static PrintWriter screen = new PrintWriter(System.out, true);
public static void main (String[] args) throws IOException
double hoursa, minutesa, secondsa;
String hours;
System.out.print ("Please enter a number of hours: ");
hours = keyboard.readLine();
hoursa = Double.parseDouble(hours); //asks programmer friendly user to enter hours
String minutes;
System.out.print ("Please enter a number of minutes: ");
minutes=keyboard.readLine();
minutesa = Double.parseDouble(minutes); //asks programmer friendly user to enter minutes
String seconds;
System.out.print ("Pretty please enter a number of seconds: ");
seconds = keyboard.readLine();
secondsa = Double.parseDouble(seconds); //asks programmer friendly user to enter seconds
double allseconds;
allseconds = (hoursa * 3600) + (minutesa * 60) + secondsa; //adds up all the seconds of the time entered
System.out.println ("You have: " + hours + " hours..."); //displays hours
System.out.println ("" + minutes + " minutes..."); //displays minutes
System.out.println ("and " + seconds + " seconds..."); //displays seconds
System.out.println ("to get whatever you need to done!"); //witty attempt at humor
System.out.println ("The total amount of seconds is: " + allseconds + " seconds."); //displays total seconds
// } <----- MAIN FUNCTION USED TO END HERE!!!
//but we want to keep going so remove the bracket!
// An application that finds the distance between two points when the points
// are given by the user.
// { <-- other function used to start here, but now it continues
double x1, x2, y1, y2, total, distance;
String xa;
System.out.print ("Please enter the 'x' coordinate of first point: ");
xa = keyboard.readLine();
x1 = Double.parseDouble(xa); //asks programmer friendly user to enter first x value
String ya;
System.out.print ("...also need the 'y' coordinate of first point: ");
ya = keyboard.readLine();
y1= Double.parseDouble(ya); //asks programmer friendly user to enter first y value
String xb;
System.out.print ("...and the 'x' coordinate of the second point: ");
xb = keyboard.readLine();
x2 = Double.parseDouble(xb); //asks programmer friendly user to enter second x value
String yb;
System.out.print ("...don't forget the 'y' coordinate of the second point: ");
yb = keyboard.readLine();
y2 = Double.parseDouble(yb); //asks programmer friendly user to enter second y value
total = Math.pow(x2 - x1, 2.0) + Math.pow(y2 - y1, 2.0); //squares the differences of values
distance = Math.sqrt(total); //finds the square root of the sum of the differences of the values
System.out.print ("E=mc^2...oh and,");
System.out.print ("the distance between point (" + xa +"," + ya +") and point("+
xb + "," + yb + ") is : " + distance);
//second function used to end here...
//} <--- COMMENT OUT BRACKET SO WE CONTINUE
// An application that takes the radius of a sphere and finds and prints
// the spheres volume and surface area.
//{ <--- ANOTHER ONE TO COMMENT OUT
double radius,volume,area;
String rad;
System.out.print("Please enter the radius of a sphere: ");
rad = keyboard.readLine();
radius = Double.parseDouble(rad); //asks programmer friendly user to enter the radius of a sphere
DecimalFormat fmt = new DecimalFormat ("0.####");
volume = ((4 * Math.PI * Math.pow(radius,3.0)) / 3) ;
System.out.println (" The sphere has a volume of:" + fmt.format(volume)); //finds and displays volume
area = ( 4 * Math.PI * Math.pow(radius, 2.0)) ;
System.out.print (" The Surface Area of the sphere is: " + fmt.format(area)); //finds and displays surface area
// } <----- COMMENTED OUT FOR THE SAME REASON
// An application that finds the total, in dollars and cents, of a number of quarters,
// nickels, dimes, and pennies in your piggy bank.
//{ <----AND ANOTHER
int pennies, nickels, dimes, quarters;
double money1;
screen.println("Empty your piggy bank and count the change, how many quarters ya have?: ");
int q = (new Integer(keyboard.readLine())).intValue();//asks programmer friendly user to enter a number of quarters
screen.println("How many dimes?: ");
int d = (new Integer(keyboard.readLine())).intValue();//asks programmer friendly user to enter a number of dimes
screen.println("How many nickels?: ");
int n = (new Integer(keyboard.readLine())).intValue();//asks programmer friendly user to enter a number of nickels
screen.println("How many pennies?: ");
int p = (new Integer(keyboard.readLine())).intValue();//asks programmer friendly user to enter a number of pennies
NumberFormat money = NumberFormat.getCurrencyInstance();
money1 = (.25 * q) + (.1 * d) + (.05 * n) + (.01 * p);
screen.println("You're rich! Total, you've got: " + money.format(money1));//finds and displays total money
}P.S. To make the code formatted better put [ code ] before and [ /code ] after. It's not perfect, but a little better... -
Hi, I'm very new to java - 2nd day. Trying to move from Visual FoxPro.
In testing statements to learn java, I can't seem to get java.util.Scanner.nextInt or nextDouble ... etc. to wait for a keyborad input. Is there something I have to configure before utilizing ...Scanner.nextWhatever?
I'm using the latest java (just downloaded 2 day ago) and TextPad as my editor.
Thanks you.Hi Petes1234:
Thanks for you quick response!!!!
The following is the code very simple ... still my "Hello World!" phase of learning.
import java.util.Scanner;
public class ScannerApp
static Scanner sc = new Scanner(System.in);
public static void main(String[] args)
System.out.print("Enter an integer: ");
int x = sc.nextInt();
System.out.println("You entered " + x + ".");
}The above code complies fine. But when I try to run it, it errors out with the following error:
Enter an integer: Exception in thread "main" java.util.NoSuchElementException
at java.util.Scanner.throwFor(Scanner.java:838)
at java.util.Scanner.next(Scanner.java:1461)
at java.util.Scanner.nextInt(Scanner.java:2091)
at java.util.Scanner.nextInt(Scanner.java:2050)
at ScannerApp.main(ScannerApp.java:11)
See anyting I'm doing wrong here? -
New to Java need to parse a page on HTTPS server
Greetings:
I am writing a "widget" on Macintosh that goes out and gets a simple piece of information from a page within a secure sever (HTTPS).
The big picture is: I need to send login information which is stored in a JavaScript form to a java application that would go to the https site and login and then go to a page and parse it for a number. This has been done in Perl originally but the Perl requires a specific library added to your system. My java application needs to pass the number back to JavaScript and hence a number will show up in my widget's window. There will be no browser involved... the widgets are JavaScript/XML based.
I would need a good example of code to do this as I am VERY new. If anyone can help please let me know.http://onesearch.sun.com/search/developers/index.jsp?charset=UTF-8&qt=%2Bparse+%2Bhttps&col=javadoc&col=devforums&col=javatecharticles&col=javatutorials&col=devarchive&col=javasc&col=devall
-
Hi, i'm new to java. need help setting the path in win XP
hi all,
i'm new to java technology. i've just downloaded the JDK and ran my first java program (hello world). i love it. java's gr8. i need help. i run win XP and how can i setup the path sothat i can execute my programs from the root dir??? any help in this direction will be greatly appreciated. please email me @ [email protected]
Best regards
MrinalGo to Start menu and select Control Panel. In the Control Panel, double click on System. In the System dialogue, choose the Advanced tab. Then click on Environmental Variables. Select Path and Edit. Put ;c:\j2sdk1.4.0\bin at the end of the Path (or c:\j2sdk1.4.0\bin;) at the start of the Path. That's it.
-
Hi,
I'm completely new to java and after a few days search found Studio Creator and decided to use it. Happily developing for a week in JSC, I reached the deployment to Tomcat stage.
Mybe I'm missing something but I find this stage ruining the ease-of-use feeling which I got when I started using JSC.
Am I right that JSC doesn't have a built-in functionality to deploy to Tomcat whithout my intervention, considering my total unfamiliarity with xml, jsp, mysql, etc.?
If so do you guys know of another easy-to-use IDE like JSC?
Any pointers are greatly appreciated.
Thanks, AbrahamHi,
Try this FAQ on
How do I deploy web applications developed with Java Studio Creator to the Tomcat Servlet/JSP Container?
at http://developers.sun.com/prodtech/javatools/jscreator/reference/faqs/technical.jsp
MJ -
New to java(need help on access specifier)
hi! i am new to java.plzzzzz help me i have to make a project on access specifier's i know all theroy.but
i am unable to understand how i can define all specifiers practicly.i mean in a program.
thanks.plzzzzzzzz help methe most common project i can think of is a payroll system..
you can have real implementation of all the access specifiers
good luck -
New to java, need a applet loop
Hello, I am trying to create a simple double buffering tile drawing applet based on a two dimensional map array. I have it working fine, however I would like to create a main loop which will keep calling pain() until the escape key is pressed. Can someone please show me how I can do this? Would I need to call repaint() in paint() until escape is pressed? Here is my code.
import java.awt.Graphics;
import java.awt.Image;
import javax.swing.ImageIcon;
import javax.swing.JApplet;
public class Tile_engine extends JApplet {
private final int TILE_MAX = 4;
private final int TILE_SIZE = 32;
private final int APPLET_WIDTH = 640;
private final int APPLET_HEIGHT = 480;
private final int SKY = 0;
private final int CLOUD_1 = 1;
private final int CLOUD_2 = 2;
private final int RED_BRICKS = 3;
private final int MAP_ROWS = 15;
private final int MAP_COLS = 20;
private Image buffer = null;
private Graphics bufferg;
private Image[] tile = new Image[TILE_MAX];
private final int map[][] =
{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,1,2,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,0,0,0,0},
{0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,3,3,0,0,3,0,0,0,0,0,0,0,0,0},
{3,3,3,3,3,3,3,3,0,0,3,3,3,3,3,3,3,3,3,3},
{3,3,3,3,3,3,3,3,0,0,3,3,3,3,3,3,3,3,3,3}};
public void init( ) {
tile[SKY] = getImage(getDocumentBase(), "sky.png");
tile[CLOUD_1] = getImage(getDocumentBase(), "cloud_1.png");
tile[CLOUD_2] = getImage(getDocumentBase(), "cloud_2.png");
tile[RED_BRICKS] = getImage(getDocumentBase(), "red_bricks.png");
buffer = createImage(APPLET_WIDTH, APPLET_HEIGHT);
bufferg = buffer.getGraphics();
public void paint(Graphics g) {
if(buffer != null) {
int tile_id;
for(int y=0;y<MAP_ROWS;y++) {
for(int x=0;x<MAP_COLS;x++) {
tile_id = map[y][x];
bufferg.drawImage(tile[tile_id], x * TILE_SIZE, y * TILE_SIZE, this);
g.drawImage(buffer, 0, 0, this);
}Isn't %d an integer? You are passing a double. You need to use the correct formatting type for a double.
When posting code, please use code tags (see button above posting box). It makes the code much easier to read. -
Hello,
I have am new also to Java and would like to know what to download first. I want to work with databases and use java as the front end. The databases I use are MySql. I am really excited about this language because I have a Apple at home and a PC at work. By the way I have read this I can use both and not have to worry about different OS. This sounds great.Hi
Welcome to Java!
I don't know much about Macs, but for PC you need the following:
-The JDK (Java Development Kit)
JDK 5 is the current version (jdk 6 due before end of year).
http://java.sun.com/javase/downloads/index.jsp
-A Java IDE (Integrated Development Environment - in case you didn't know ;) )
I recommend Netbeans as your IDE. Check out:
www.netbeans.org
It's free and runs on Mac too, assuming you have jdk5.0 for Mac. Netbeans 5.5 is the latest version (released a few days ago) and requires jdk5.0, Netbeans 5.0 requires only JDK1.4.2 if you only have on older JDK on your mac. Various plugins are available on the netbeans site too. -
I go start my course in Java programming,but first, because i need start from the beggining i need make one module wich gonna take me around 1 nad a half month. Because i want star more soon understand about programming i bought "Java A beginner's guide. Note i never make any kind of programming in my life. I start read the book and not found any problem my problem appears when i reach the first simple program. I get the J2SE 5 and they say the program run in command prompt but my command prompt when i open always appears c:\>documents and settings>nuno blanc i just ca,t take out that .documents and settings. i try everything what i know.
They say is well for i use Word Pad. i use the word pad and after i dont know how to run the program witch i made. If someone able to help-me please help me here or in my mail [email protected] i want start enter in programming.
Please!
Thank'sI go start my course in Java programming,but first,
because i need start from the beggining i need make
one module wich gonna take me around 1 nad a half
month. Because i want star more soon understand about
programming i bought "Java A beginner's guide. Note i
never make any kind of programming in my life. I
start read the book and not found any problem my
problem appears when i reach the first simple
program. I get the J2SE 5 and they say the program
run in command prompt but my command prompt when i
open always appears c:\>documents and settings>nuno
blanc i just ca,t take out that .documents and
settings. i try everything what i know.
They say is well for i use Word Pad. i use the word
pad and after i dont know how to run the program
witch i made. If someone able to help-me please help
me here or in my mail [email protected] i want start
enter in programming.
Please!
Thank'sHi,
Unfortunately, it's fairly difficult to get Java set up on your computer and learn to run programs. You should read the tutorial, "Your first Cup of Java":
http://java.sun.com/docs/books/tutorial/getStarted/cupojava/
It will lead you through the steps of installing Java and running your first program.
Because i want star more soon understand about
programming i bought "Java A beginner's guide. I've read the 2nd edition of that book, and I thought it was a good book. I do have previous programming experience, though. I thought it was a good, short overview of Java. Other beginning books are much longer and can get pretty complicated.
Good luck. -
New to java-need help for debugging
hey there
i just wanted my first program in java and here it is below with the error when i'm compiling it, i cant understand whats wrong:
public class SquareArea {
public static void main(String[] args); {
float length;
float width;
float SquareArea;
System.out.println ("Please enter length"+ length);
System.out.println ("Please enter width"+ width);
SquareArea= length*width;
System.out.println ("The area of the square is" + SquareArea);
The error is:C:\Documents and Settings\User\Desktop\SquareArea.java:5: missing method body, or declare abstract
public static void main(String[] args); {
^
1 error
Tool completed with exit code 1Reading inputs from the command line is a bit complicated in java, here is how it is done:
first add the line:
import java.io.*;to the beginning of your program.
float length;
float width;
float SquareArea;
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
try
System.out.println ("Please enter length:");
String lengthStr = reader.readLine();
length = Float.parseFloat(lengthStr);
System.out.println ("Please enter width");
String widthStr = reader.readLine();
width = Float.parseFloat(widthStr);
SquareArea= length*width;
System.out.println ("The area of the square is" + SquareArea);
catch (IOException ioe)
System.out.println("Error reading values.");
ioe.printStackTrace();
} -
Very new to Java!!! HELP!!!!
very simple, how do I set everything up in Windows XP????
it doesn't seem to work for me!
I tried to run javac.exe and java.exe it just goes to command prompt and then disappears!!!!!!! AHHHHHHHHHH!!! help!
thanksi get the error when I run the helloworldapp
this: C:\documents and settings\hanamachi\java stuff>
java HelloWorldApp
Exception in thread "main"
java.lang.NoClassDefFoundError: HelloWorldApp
huh???You didn't follow the directions carefully, particularly the part about setting your classpath. You can remedy this in the short term by using the following command:
java -cp . HelloWorldAppI highly recommend you go back through the instructions, though, and follow them very carefully. -
New to Java, need assistance
First, I'd like to apologize in case this post is in the wrong place.
Now I'm new to Jcreator and I missed about a month from my computer programming class in school, and am far behind. My assignment right now is this problem p5.12 from Computing Concepts with Java Essentials it says:
"A year with 366 days is called a leap year. A year is a leap year if it is divisible by 4 (for ex.,1980). However, since the introduction of the Gregorian calender on October 15, 1582, a year is not a leap year if it is divisible by 100 (for ex., 1900); however, it is a leap year if it is divisible by 400 (for ex., 2000). Write a program that asks the user for a year and computes whether that year is a leap year., Implement a class *Year* with the method *boolean isLeapYear*
This is the code that I came up with:
import javax.swing.JOptionPane;
public class LeapYear {
public static void main(String[] args) {
String input = JOptionPane.showInputDialog("Enter Year");
double year = Double.parseDouble(input);
LeapYear newYear = new LeapYear(year);
System.out.println(newYear.boolean isLeapYear()); //line 11
public class LeapYear {
private double year;
public LeapYear(double year)
a = year;
public boolean isLeapYear(){
if(a % 4 == 0)
if(a % 100 != 0) System.out.println("Leap Year");
else if (a % 400 == 0) System.out.println("Leap Year");
else System.out.println("Not Leap Year");
The error I am receiving is on the 11th line of the test class. I know if there is something wrong besides that. I'm not asking for someone to fix this for me but I would like if somebody could give me advice on what to do, hints, explain where I went wrong, or know of any good tutorials I could read that could help me with this it would be much appreciated.Year Is Leab Year?
1 no
4 yes
1580 yes
1582 no
1584 yes
1600 yes
1700 no
1800 no
1900 no
1996 yes
1997 no
1999 no
2000 yes
2100 no
2200 no
2300 no
2400 yes
2800 yes
2900 no
3200 yes
3300 no
3600 yes
3800 no
4000 yes
4200 no
4400 yes
4700 no
4800 yes
5100 no
5200 yes
6400 yes
6500 no
6800 yes
6900 no
7200 yes
7400 no
7600 yes
7800 no -
New to Java -- Need to know if something is possible
We have an application in which some complex calculations are being done in MatLab. In order to speed things up, we are converting it to C/C++. But there is also a GUI in the MatLab code. This is all to run on Windows.
We will eventually (2 - 4 months from now, after it has been successfully converted and running) need to also port it to Linux. I am thinking that I would like to write the GUI portion in Java, so that it can be easily transferred from Windows to Linux.
There is also an "embedded" portion running in C/C++. This must remain in C++ in because it is a real-time application where literally each microsecond will matter, Java will be too slow. In addition, some of the calculations will run on a parallel processing board, and the COTS libaries that support running on the card are C/C++ libraries.
So, what I want is, to make a Java GUI that I can move from Windows to Linux, and in this GUI, each of the callbacks will then do nothing but call a C++ routine. I need the C++ routine to run completely independent of the Java Virtual Machine, to preserve the speed of the C++ library.
My questions:
If I write the GUI in Java, and have separate libraries/fucntions in C/C++ that are compiled for both Windows and Linux, can the Java GUI call these, and will they run as fast as they would in a normal C++ app? Or will it be slowed down by the JVM, and run at "interpreter speed"?
How do you call the C++ code from inside a Java interpreter? Do we compile it all in a dll, and the dll is called from Java? Do we make a C++ library, and that can be called from the Java GUI? Or is there something else. This must have been done many times, does anybody have any suggestions or experience to get me going. I think I can glom together a simple Java GUI ( I produced some Java programs several years ago), and I can get the C++ libraries going, it is connecting them that I could use some guidance.
Thanks.
- Martingeorgemc wrote:
DrLaszloJamf wrote:
georgemc wrote:
DrLaszloJamf wrote:
georgemc wrote:
Ignore the myth that Java executes slowly because it's "interpreted". It's notHear, hear. Brian Goetz is a good source of Java myth debunking. Check out his columns:
http://www.ibm.com/developerworks/views/java/libraryview.jsp?search_by=practice:
Indeedie. Here's his article I like to trot out on occasions such as this
http://java.sun.com/developer/technicalArticles/Interviews/goetz_qa.html
I love to point out on some benchmarks, Java can be faster that C. "Faster than C? That's impossible!", people sputter, as if C were a physical constant, like the speed of light -- that's "c", folks!That's borne out of the misconception that any operation in Java is simply translated by the runtime into a similar operation in native code, and, were that the case, they'd probably have a point. It completely ignores runtime optimizationsAnd other things like Java's object allocation/GC being superior to malloc(), ... -
Writting Tools for Java (Very new to java HELP!!!!)
It's hard to write a java applet using a windows notepad, because I must to save as a *.java files, open a msdos prompt type (javac *.java), and run it (very inefficinet :( ).
Doesn't like Vb, notepad didn't alert me if I make a mistake like this :.
--System.out.println("good")
--Sistem.out.println(":( wrong)
HELP ME PLEASEEEEE!!!!Forte, where can I download it from?Link to Forte (now called Sun One Studio 4):
http://wwws.sun.com/software/sundev/jde/index.html
Link to JCreator (a text editor):
http://www.jcreator.com/
Link to search results on Google.com:
http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=java+ide%2Ceditor
Maybe you are looking for
-
Itunes wont sync error message this computer is not authorized
itunes will not sync my purchased songs to my new ipod touch, i get an error message that says, "some of the songs purchased cannot be transferred, this computer is not authorized, go to store, then authorize this computer." I have done this over a
-
How do I get rid of BB App World Notification?
I just got my BB last night, so I'm very new to this, but I did the update on the BB App World, and there were some apps that I did not want (such as Yahoo Messenger) that it kept coming up that there was an update available for... so I uninstalled t
-
Bonjour, Je souhaiterais piloter mon étuve en RS232, lorsque j'utilise le VI lecture et écriture Série, peu importe sur quel port je suis (COM1 ou COM2), le VI s'exécute entièrement mais l'étuve ne bouge pas, et encore mieux si je débranche l'étuve,
-
My page documents are all blurred
my page documents are all blurred like a photo that is not developed
-
We have AS5350XM (see detail in version.txt). After some times when I calling to AS - I receive "BUSY" and debug show me: *Apr 5 17:09:12.306: msg_to_calls_mgmt: msg type CPM_VOICE_CALL_REJ_NO_MOD_AVAIL received I reload AS, and 6-8 hours have no any