|
is Sun's very own.
If you are using NetBeans (or Eclipse or another IDE), then you won't need to worry too much about the installation stuff.
If you want to do things the hard way (as Sun's tutorials assume), then you need to make sure you follow the installation guide carefully. Mainly so the Java binaries are in the system path.
When you do it this way, you will have to understand how the package hierarchy works and where you need to be relative to that when you launch your programs. It's a real PITA, but the experience is very helpful. Good luck.
|
|
|
|
|
C#
private void button_Click(object sender, EventArgs e)
{
SerialPort sp = new SerialPort(SerialPort.GetPortNames()[0], 9600, Parity.None, 8, StopBits.One);
String[] str = SerialPort.GetPortNames();
sp.Open();
sp.DtrEnable = true;
sp.RtsEnable = true;
sp.WriteLine("Hello World!");
sp.Close();
}
Java
Enumeration pList = CommPortIdentifier.getPortIdentifiers();
CommPortIdentifier cpi = (CommPortIdentifier) pList.nextElement();
if (cpi.getPortType() == CommPortIdentifier.PORT_SERIAL && cpi.getName().compareTo("COM1") == 0) {
try {
CommPort port = cpi.open("DarwinSys Printing", 30 * 1000);
try {
OutputStream os = port.getOutputStream();
String str = "Hello World!";
byte[] b = str.getBytes();
os.write(b);
os.flush();
os.close();
} catch (IOException ex) {
}
} catch (PortInUseException ex) {
}
I have a device on the serial port which has a led on it. The LED blinks on the C#'s code. I think the code i have written in java is approximately doing the samething but the LED does not blink.
thanks in advance.
|
|
|
|
|
Hi team,
plz explain this program how to run, i want full source code..
thanks
MANI.G
|
|
|
|
|
I got a kind of weird problem. I have created a Java Desktop Application project in NetBeans. I have created a new java class say A. Class A does not has MAIN in it. It contains just METHODS like insert, delete, update, openConnection, closeConection and others like that. To test the class A, I created the MAIN in it and tried to connect to the database, the database connects successfully and all the methods work aswell.
I created a button on the java application and the method which is called when the button is called is named as button1Pressed. Here is the simple code in the button event.
@Action
public void button1Pressed() {
A a = new A();
a.openConnection();
}
Here is the method in class A
public void openConnection() {
String connectionString = "jdbc:mysql://172.16.11.12:3306/Projector_Manager";
try {
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection(connectionString,"root","1");
insertStatement = conn.prepareStatement("insert into Current_Status values (?,?,?,?,?)");
} catch (SQLException ex) {
System.out.println(ex.getMessage());
} catch (ClassNotFoundException ex) {
System.out.println(ex.getMessage());
}
}
The error on the statement is
Communications link failure<br />
<br />
Last packet sent to the server was 1 ms ago. the error comes after 4-5 minutes and until then the application hangs.
but when I declare MAIN in the class A like
public static void main(String[] args)
{
A a = new A();
a.openConnection();
} and execute the code it connects to the database fine.
I dont know why it connects to the database the single file is executed and not when i run the GUI and press the button and it goes to the same code and does not connect.
I have also pasted the whole code in the button1Pressed but still it does not connects to the database
|
|
|
|
|
Can any some say whether its possible to develop a discussion forum using core java? if so can somebody share info on how to start on with that...
|
|
|
|
|
hi
i need to know how to impliment port adress translation for a simulator program, can anyone help
many thanks
|
|
|
|
|
Hi
i know this is possile but i dont know how. i need to set up multiple IP adresses on a single machine using java and forward each IP to a specified port. can some one please point me in the right direction to creating multiple IPs on a single machine.
note this is for a simulator program and requires the possibility to create a few hundred IP's.
many thanks
rich
|
|
|
|
|
You can assign multiple IP addresses on a single machine by entering into the network adapter's properties and then open "Internet Protocol Version 4 (TCP/ IPv4)" properties. Press the advance button and add as many IP addresses as you want. And then use those IP addresses in java.
I hope I answered it right. (for vista)
|
|
|
|
|
thanks for your responce, yeah thats correct however i need to impliment these IP's at run time and dynamically. The program im creating is part of a server application and will need to create these IP's based on data from clients at runtime rather than creating them through TCP/IP settings before hand.
is there a way to impliment multiple IP's throught java code?
|
|
|
|
|
i tried alot. even searched through net. but could no find anything. one way is to add maximum number of ipaddresses in the list and keep a list in ur program. use the free one when a request comes.
|
|
|
|
|
Hi Everybody,
I have a file which I use for writing some output during the run of the program. I also want this file to hold the error stream, in case of a problem.
I created the following code, to check what happen:
PrintStream psMyFile = new PrintStream("myFile.txt");
FileOutputStream fos = new FileOutputStream("myFile.txt", true);
PrintStream psErrorStream = new PrintStream(fos);
System.setErr(psErrorStream);
for (int i=0; i<5; i++)
psMyFile.println("line " + i);
System.err.println("This is an error 1");
psMyFile.println("after the error");
System.err.println("This is an error 2");
psMyFile.println("finished");
The content of "myFile.txt" afterward are:
line 0
line 1
line 2
line 3
line 4
after the error
finished
an error 2
As you can see, some of the errorStream text was lost. Also, I would expect that the last line will appear before the line before it.
Why does that happen? Is there a way to synchronize the writing, so that nothing will get lost?
TIA!
Dikla
|
|
|
|
|
Is there any java program that can present hierarchical data in a true tree format, as an alternative to using the standard TreeView control.
This is already avaible in C# and the link below would show you where the example is.
I wonder if the java version is avaible anywhere?
www.asp101.com/articles/jayram/treecontrol/default.asp
|
|
|
|
|
hi guys, my programming knowledge is very little. recently, i'm trying to implement a program that will do the following things :
i want to develop a program that will check how much data i'm receiving (just like a network monitoring software) while i'm connected to the internet. if my receiving amount of data is less than 2 KBps then it will play an audio file located on my hard disk. otherwise, it will do nothing. oh one more thing, the program will check the amount of receiving data every hour.
i know my idea will seem weird to all of you but i'm in serious need of this program. so please if anybody can do it for me i'll be grateful to him forever. u can make it using any language. VB,C,C++,Java doesn't matter to me. i want this program as soon as possible.this is my earnest request to all of you.
my email address : r2000.gp@gmail.com
romance
|
|
|
|
|
Hi,
I have an issue that I have to parse a query and separate all the words as well as I have to separate all the phrases from those
can any one suggest for this
|
|
|
|
|
Hello,
Assume I have this class
public class Car {
public Car() {};
}
and this class:
public class Mercedes extends Car {
public Mercedes() { super(); }
}
and this method:
public Car getNewMercedes() {
return new Mercedes();
}
I get this error:
This method must return a result of type Car
How do I fix this
Thanks in advance
|
|
|
|
|
Looks like getNewMercedes() is not within the Block .
There seems to be some thing wrong with the getNewMercedes() return type or block of code.
if you can provide us the Error, we can resolve easily..
The Universe is a Figment of our Imagination.
|
|
|
|
|
where i should add init parameters for a servlet.what should i add in web.xml file. give me sample program and complete steps to execute
|
|
|
|
|
after writing servlet program to connect to sql2000 what are steps i should do.if i have to install jdbc drivers separetely.i am working in win2000.
|
|
|
|
|
Hey guys! Just a quick question...
So I've added a KeyListener to my JPanel for a game I'm making, and everything is working out fine, except for one thing:
When I hold down a key, keyPressed is called once, followed by a delay, followed by several consecutive calls of the keyPressed method. I understand that this has to do with the way key events are processed and that you can adjust this delay within the control panel, but is there any way to remove this delay completely?
I'm thinking what I'm going to end up doing is creating a boolean keyDown variable which is set to true on keyPressed and to false on keyReleased .
Any other ideas?
|
|
|
|
|
Well thanks for all of your wonderful help guys, but I just thought I'd let you know that I went ahead and used my idea with the boolean s.
|
|
|
|
|
i have to do natural language processing project in java
i dont have idea about that project(ie. how to start the project).can any body help me?
thanks in advance.
|
|
|
|
|
this has nothing to do with java, even though it's java your teacher wants you to code that in.
what have you done so far, and where are you stuck ?
|
|
|
|
|
iam trying to do this project like google search using (collection concept list.contains)so i need some guidance to start this project from the scratch. i dont no how to split the english sentence and find out the noun ,verb and all.so wat to do?
but i can do this project like google search.iam asking for real method of doing this project.
thanks for ur reply .
|
|
|
|
|
Can someone provide me with the method. The input to the method are xmin,xmax,ymin,ymax,x0,y0,x1,y1.
I managed to get the coordinates from listener (above) now I need the method to clip the line. I know you can use the
g.setclip or g.cliprect but i wanna know the details of how to implement the cohen in java.
Thank you
|
|
|
|
|
i need your help guyz...
i have a project in java programming...
its hard to understand...
please help me..
Q1) Define a class called Rental that has the following properties
a) Userid of string type
b) Days of rental
c) Rental per day
d) Include appropriate accessors,mutators and constructor(s) as well as a method to change the cars' information.
e) Include a method longParking which will return true if the days of car rental above 6days otherwise return false.
Q2) Define a class called Carpark that has following properties.
a) An array season_rental that can allowed up to maximum 35 car rental at a time.
b) Include a method that will allow new rental information to be included into the system.
c) include a method to search for a car rental information.
d) include a method to increase the renting rate by 12%.
e) include a method to display all rental details that are currently still being rented out.
Q3) Define a main menu program that will allow all the rental information to be manipulated.
i hope you will reply my first post as soon as possible...thx...
Godbless...
|
|
|
|