Jump to content
xisto Community
Sign in to follow this  
nonte

Java Helpdesk All your queries regarding Java Programming goes here.

Recommended Posts

Hellow friends,I am creating this thread for all queries and suggestions related to java coding. If you face any problem, post it here, and others who have a solution can post the reply here. Hope it helps the users.

Share this post


Link to post
Share on other sites

Hi guys i have a little problem here!. I've just download the Java Development Kit (JDK 1.6 BETA 2) for Linux. My Problem is how to integrate any java application like *.java *.jar with the java binaries that i've extracted. I'm newbie for linux. I'm using Ubuntu Dapper Drake (6.06).For now i just make symbolic link to /usr/bin from my java's bin/java directory. And every time I need execute my jar file. I always use terminal to run it. I've tried to right click and try to open with java binaries file. And some error occured says "Cound not add application to application database!". Err...!!Anyone can help please?? :)

Share this post


Link to post
Share on other sites

It all depends on what type of Java you are talking about. J2SE or J2ME, but my guess is J2SE because not many people program using J2ME. You can try going to Java Sun forums. They provide a lot of good solutions for you. Just by browsing the forum, you learn a lot of new things. Trust me on that because I have learnt quite some stuff from there. However their J2ME forum is a little quiet, I am just surprised why there are not many people talking about programming on the mobile. After all thats where the industry is heading.

Share this post


Link to post
Share on other sites

How to run a java file from another java file?

Java Helpdesk

 

Hi! I want to run a java file from another java file. I heard exec() method from Rumtime class. I wrote two files(Caller and Hello) for testing. Following codes:

 

Caller.Java

Import java.Io.*;

Public class Caller{

Public static void main(String args[]) throws Exception{

Runtime rt = Runtime.GetRuntime();

Process prcs = rt.Exec("java Hello");

 

Hello.Java

Import java.Lang.System;

Public class Hello{

Public static void main(String args[]){

System.Out.Println("Hello World.");

}

}

 

Although I compile and run successfully but I didn't get result I neeed (printing Hello World). Please help me! Thanks so much!

 

-question by thungphan

Share this post


Link to post
Share on other sites

How to run a java file from another java file?

 

Java Helpdesk

Hi! I want to run a java file from another java file. I heard exec() method from Rumtime class. I wrote two files(Caller and Hello) for testing. Following codes:

 

Caller.Java

Import java.Io.*;

Public class Caller{

Public static void main(String args[]) throws Exception{

Runtime rt = Runtime.GetRuntime();

Process prcs = rt.Exec("java Hello");

 

Hello.Java

Import java.Lang.System;

Public class Hello{

Public static void main(String args[]){

System.Out.Println("Hello World.");

}

}

 

Although I compile and run successfully but I didn't get result I neeed (printing Hello World). Please help me! Thanks so much!

 

-question by thungphan


The Runtime.exec methods create a native process and return an instance of a subclass of Process that can be used to control the process and obtain information about it.

So if you want to get the output ("Hello World"), you need to use Process.getInputStream() method.

 

The method will return an InputStream, which you can use to generate output in your monitor.

 

This is the example of how to print the InputStream:

InputStream is = process.getInputStream();BufferedReader is = new BufferedReader(new InputStreamReader(is));	String line;	while ((line = is.readLine()) != null)	  System.out.println(line);

Share this post


Link to post
Share on other sites

Code for HR Help Desk in java

Java Helpdesk

 

I need code for HR help desk. I am unable to coding for this project. I have no time. Please help me

 

-reply by Raviteja

Share this post


Link to post
Share on other sites
Object following a mouse path in JavaJava Helpdesk

Hello all. Is it possible to select a slowly moving object (with a mouse), then draw a visible path from the selected object to a stationary point (point B) with the mouse, then (either mouse click again or let mouse button up) to hide the path and have the object keep following the (now invisible) path to point B. When the object reaches point B it will disappear. The path between the selected object and point B will not necessary be a straight line, but may be a series of curves. Hopefully I can do multiple instances of other selected objects to point B simultaneously! Any help greatly appreciated

-question by Daryl

 

Share this post


Link to post
Share on other sites

Yes, it is very possible. Just implement the path of the ball as a queue of locations to go to. With an empty queue, it would move randomly. Use mouse events to track the path of the mouse through the canvas. Then, take all those coordinates and add them to the queue for the ball. Since the queue is no longer empty, it will start to follow that path, discarding the front of the queue with each successful move operation.Things that can be added: interpolation so that the moves are smooth in case mouse events are not being reported properly. Automatic path finding so that if the path goes through a gap between obstacles that is not large enough for the ball, it searches for an alternate path (using A* or some other algorithm). Regards,z.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.