Carsten Hansen

Greenhorn
+ Follow
since Sep 04, 2003
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Carsten Hansen

Hi
Is it possible to switch between applications, etc. java - notepad - java
What I mean is, if I have a small java app. and I push a button in that app.
then I would like to detect if Notepad is already running, is Notepad running
then type some text and return to my java app.
I'm using the Robot class for typing, but I'm having trouble to detect if Notepad
is already running, and if so how to make it the active window.
Any suggestions
Regards
Carsten H.
15 years ago
Is this what you are trying to gain
Carsten

15 years ago
Well - so far so good, but is there someone who know
how use FocusTraversalPolicy or KeyBoardFocusManager
There have to be a better way than the one I figured out
Carsten

15 years ago
Hi
How to set tab order i a JTable
Let's say I have a table containing 5 columns
and I want the tab order to be column1 column3, column4
and continue at next row
How can I make that happen - I don't know where to begin.
Carsten
15 years ago
Hi
How to set tab order i a JTable
Let's say I have a table containing 4 columns
and I want the tab order to be column1 column3, column4
How I make that happen - I don't know where to begin.
Carsten
15 years ago
Problem solved - I found the solution in this forum
A clever fellow wrote this.
web page
15 years ago
Hi
I've been searching this forum for a solution to my problem, but didn't find any.
I want to load a class from a jar file, and somehow I've succeded,
but I can't use the loaded class, it's a driver for a MySQL db.
I'm loading the class in method loadDriver().
and receiving an error in method dbConnection( String databaseURL, String username, String password)
The error is "No suitable driver"
How can I load the driver in a way that gives some benefit?
I would really appreciate some help on this.
See the code below.
Regards
Carsten
15 years ago
Sorry I didn't check for answers but i I didn't expect any answer
This works - and again it don't!
import java.net.*;
import java.io.*;
public class AddClassPath{

public AddClassPath() {
try{
URL[] url = {new File("d:\\jarfiles\\mysql-connector-java-3.0.7-stable-bin.jar").toURL()};

URLClassLoader loader = new URLClassLoader(url);

try{
System.out.println("Trying to load class");
Class c = loader.loadClass("com.mysql.jdbc.Driver");
System.out.println("Class loadet");
if(c == null)
System.out.println("Class not loaded!!");
Object driver = c.newInstance();
System.out.println("New instance created");
}
catch(InstantiationException i){
i.printStackTrace();
}
catch(IllegalAccessException il){
il.printStackTrace();
}
catch(java.lang.ClassNotFoundException c){
c.printStackTrace();
}

}
catch(java.net.MalformedURLException mal){
mal.printStackTrace();
}
}
}
Again it works, but I'am missing something, I can't seem to make
it global.
I'am using RMI, and here is where I'am having trouble, it throws
a ClassNotFoundException.
What did I miss ???
Can You get me any closer ??
16 years ago
Hi.
Is it possibel to add a classpath to a .jar file programatically
from an running application
I would like to add this directory 'd:\jars\MyJar.jar'
16 years ago