Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
zootm
Aug 8, 2006

We used to be better friends.

Mustach posted:

The lesson is that everything that depends on input should be in the try block:
I'd consider this pretty bad style - it's usually best to avoid putting code that doesn't throw a given exception in a 'try' block which catches it. Removing the '= null' from the variable declaration will cause the compiler to check that any control flow to a line where you use the variable definitely assigns it.

There's two other problems here though - the compiler may not recognise that System.exit terminates control flow (although really avoiding that function is the best solution for that). The other problem is that FindBugs may not think that 'readLine' returns a non-null value.

Adbot
ADBOT LOVES YOU

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

zootm posted:

I'd consider this pretty bad style - it's usually best to avoid putting code that doesn't throw a given exception in a 'try' block which catches it. Removing the '= null' from the variable declaration will cause the compiler to check that any control flow to a line where you use the variable definitely assigns it.

There's two other problems here though - the compiler may not recognise that System.exit terminates control flow (although really avoiding that function is the best solution for that). The other problem is that FindBugs may not think that 'readLine' returns a non-null value.

What would be another way to terminate flow? Just a simple return?

Mustach
Mar 2, 2003

In this long line, there's been some real strange genes. You've got 'em all, with some extras thrown in.

zootm posted:

I'd consider this pretty bad style - it's usually best to avoid putting code that doesn't throw a given exception in a 'try' block which catches it. Removing the '= null' from the variable declaration will cause the compiler to check that any control flow to a line where you use the variable definitely assigns it.
Half of the point of exceptions is separating error-handling from "best-case" code. I don't know what you mean by removing '= null'; that would cause a spurious error in your version. Maybe I'm misunderstanding you, but it sounds like these are examples of our styles:
code:
// Mustach version
String input;
try{
  input = in.readLine();
  if(input == null) continue;
  else if(isExitCommand(input)) break;
  else doWhateverIWantWithInput(input);
}catch(IOException e){
  oops(e);
}catch(WhateverIWantException e){
  oops2(e);
}
versus
code:
// zootm version
String input /* = null */;
try{
  input = in.readLine();
}catch(IOException e){
  oops(e);
}
if(input == null) continue; // error, variable 'input' might not have been initialized
else if(isExitCommand(input)) break;
else try{
  doWhateverIWantWithInput(input);
}catch(WhateverIWantException e){
  oops2(e);
}
I can't see any benefits, stylistic or otherwise, to the second version.

edit: I got the semantics of readLine() wrong again; just pretends it's some other readLine().

Mustach fucked around with this message at 13:31 on Aug 29, 2008

zootm
Aug 8, 2006

We used to be better friends.

Mustach posted:

code:
// zootm version
String input /* = null */;
try{
  input = in.readLine();
}catch(IOException e){
  oops(e);
}
if(input == null) continue; // error, variable 'input' might not have been initialized
else if(isExitCommand(input)) break;
else try{
  doWhateverIWantWithInput(input);
}catch(WhateverIWantException e){
  oops2(e);
}
More like this (assuming that in is a BufferedReader wrapping System.in there is no need to check if the input is null, since that stream doesn't terminate):
code:
String input;
try {
  input = in.readLine();
} catch( IOException e ) {
  throw new UnhandledException( "Unexpected error reading input", e );
}

// No compiler error below because the try block is guaranteed to have run.
System.out.println( "Input was: " + input );
Of course the other way to do it would be to just don't catch the exception, allowing it to propagate to somewhere that might actually have error-handling code. It is absolutely correct to just add a "throws" clause if you have no intent to recover from the exception. The UnhandledException up there is a RuntimeException from Commons Lang which is used when you don't have cleanup code but you can't throw a non-Runtime exception for interface reasons or similar. If you have a default value for input in this case, you can assign that in the catch too, and the compiler will not complain.

zootm fucked around with this message at 13:50 on Aug 29, 2008

Mustach
Mar 2, 2003

In this long line, there's been some real strange genes. You've got 'em all, with some extras thrown in.
What makes that superior to
code:
String input;
try {
  input = in.readLine();
  // No compiler error below because the try block is guaranteed to have run.
  System.out.println( "Input was: " + input );
} catch( IOException e ) {
  throw new UnhandledException( "Unexpected error reading input", e );
}
? That's all I'm arguing about, not the merits of throwing/rethrowing or exiting/not-exiting, etc.

zootm
Aug 8, 2006

We used to be better friends.

Mustach posted:

What makes that superior to
code:
String input;
try {
  input = in.readLine();
  // No compiler error below because the try block is guaranteed to have run.
  System.out.println( "Input was: " + input );
} catch( IOException e ) {
  throw new UnhandledException( "Unexpected error reading input", e );
}
? That's all I'm arguing about, not the merits of throwing/rethrowing or exiting/not-exiting, etc.
I find that that sort of thing tends to muddy up the code clarity; the one I posted makes it immediately apparent what code throws the exception. Also when people add extra "throws" to other methods in the logic, you may not want the same cleanup code to be executed.

Entheogen
Aug 30, 2004

by Fragmaster
I have class Coordinate which contains 3 doubles x,y,z. I have coordinates_triangles = TreeMap< Coordinate, Vector< Triangle > >

there is problem with following code
code:
for( Coordinate a : coordinates_triangles.keySet() )
{
     Vector<Triangle> triangles = coordinates_triangles.get( a );
Sometimes triangles is null for no apparent reason. I always create new Vector<Triangle> for every mapping i make for this map. The number of times it comes out to null for certain mappings is variable upon implementation of compareTo in Coordinate class.

here is code for it

code:
public static double _epsilon = 1e-6;

    public int compareTo( Object o )
    {
        if( o instanceof Coordinate )
        {
            Coordinate c = ( Coordinate ) o;
            
            if( Math.abs( x - c.x ) > _epsilon )
            {
                return Double.compare( x, c.x );
            }
            if( Math.abs( y - c.y ) > _epsilon )
            {
               return Double.compare( y, c.y );
            }
            if( Math.abs( z - c.z ) > _epsilon )
            {
               return Double.compare( z, c.z );
            }
        }
        return 0;
    }
What is going on here?

Entheogen fucked around with this message at 00:47 on Aug 30, 2008

the onion wizard
Apr 14, 2004

The Coordinate class should probably implement Comparable<Coordinate>, or throw a ClassCastException if the supplied object isn't a Coordinate.
However, I don't think compareTo is the cause of your issue, as the worst that would do is overwrite existing keys when it's not supposed to (or vice versa).

You must be calling put with a null value at some point; I can't see any other way that there would be a null value for a key present in the map.

zootm
Aug 8, 2006

We used to be better friends.
Make sure that a.equals( b ) iff a.compareTo( b ) == 0. The first condition needs to be true for 'get' to yield a value, but the second is the case where keys will overwrite elements, I think.

invid
Dec 19, 2002
I'm creating a jsp powered booking system and I'm not sure how I should be doing the controller classes. I have a jsp (view) that displays all the bookings, and on that page, users can add or delete them. Currently I'm using a addBooking servlet, should I be creating a delBooking Servlet, or is there a better way to do this (MVC)?

dancavallaro
Sep 10, 2006
My title sucks
I have a bunch of mailing list data in an Excel file that I want to put in an Access file (I would prefer/it would be easier to use mySQL, but I'm doing this pro bono for a non-profit and they want it in an Access DB). Ideally I could just import the data into Access using the import wizard, but I need to do some processing on the data before I can import it, and I want to split it into 2 files. I was hoping to do this with Java, because that's the language I'm most familiar with. I was hoping to just export the Excel file as CSV data, and then write a Java program to process the data and insert it into my Access database. If there's a better way to do this, I'm open to suggestions, but I'd like to use Java and I'm just having trouble interfacing with Access. How can I use an Access database from Java?

zootm
Aug 8, 2006

We used to be better friends.

invid posted:

I'm creating a jsp powered booking system and I'm not sure how I should be doing the controller classes. I have a jsp (view) that displays all the bookings, and on that page, users can add or delete them. Currently I'm using a addBooking servlet, should I be creating a delBooking Servlet, or is there a better way to do this (MVC)?
The Servlet API is pretty much intentionally over-general. You might be better looking into something like Tapestry, or Spring MVC, and just do whatever their conventions are. You'll end up building your own framework before long, otherwise.

dancavallaro posted:

I have a bunch of mailing list data in an Excel file that I want to put in an Access file (I would prefer/it would be easier to use mySQL, but I'm doing this pro bono for a non-profit and they want it in an Access DB). Ideally I could just import the data into Access using the import wizard, but I need to do some processing on the data before I can import it, and I want to split it into 2 files. I was hoping to do this with Java, because that's the language I'm most familiar with. I was hoping to just export the Excel file as CSV data, and then write a Java program to process the data and insert it into my Access database. If there's a better way to do this, I'm open to suggestions, but I'd like to use Java and I'm just having trouble interfacing with Access. How can I use an Access database from Java?
You can access Excel documents using Apache POI (this was pretty bad for a while but I hear it's a lot better now), and I'm led to believe that you can access Access databases from Java using the JDBC-ODBC bridge driver. This claims to work.

zootm fucked around with this message at 16:10 on Sep 1, 2008

dancavallaro
Sep 10, 2006
My title sucks

zootm posted:

You can access Excel documents using Apache POI (this was pretty bad for a while but I hear it's a lot better now), and I'm led to believe that you can access Access databases from Java using the JDBC-ODBC bridge driver. This claims to work.

Hmm.. after looking at all that, I think I'm just gonna try C# - it seems like it's better-supported and will be much easier. I don't need this to be cross platform, I'm only writing a program to put initial data into an Access database and then the program will never be used again.

adante
Sep 18, 2003
off the topic but for lack of better place to put it:

anybody know of any good editors out there for groovy? Preferably with code complete/assist*, auto formatting, fix imports and the other shiny stuff that eclipse has. Too long with eclipse has made me soft and I cannot code without these functions anymore!

I have tried the eclipse plugin but it leaves a lot to be desired.

*Obviously this is much harder to do for groovy, but I'm not a details man.

zootm
Aug 8, 2006

We used to be better friends.
I think that the NetBeans 6.5 beta may have Groovy support, they've added a ton of dynamic language support in there recently and it works pretty well. Failing that some nerd may well have made nice Vim or Emacs bindings.

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.
IntelliJ has the most mature Groovy and Grails plugins available, from what I've been able to tell. I write most of my Groovy in vim so I'm pretty much ignorant beyond what I can read online.

zootm
Aug 8, 2006

We used to be better friends.
I never hear anything but glowing reviews about everything IntelliJ IDEA does so yeah, if willing to fork out the cash it's likely a good call.

zootm
Aug 8, 2006

We used to be better friends.
Edit - double post

invid
Dec 19, 2002
I've a problem.

I'm using OpenCSV to parse some data into my script that will insert it into an SQL database. But I'm having some problems handling escape characters.

Here's my code:

code:
ps = conn.prepareStatement("INSERT INTO room (room_desc, room_type, room_building, max_capacity) VALUES (?,?,?,?);");
ps.setString(1, desc);
ps.setString(2, type);
ps.setString(3, building);
ps.setInt(4, capacity);
ps.executeUpdate();
Here's a sniplet of my csv file"
code:
Li Ka Shing Library (Bras Basah),Proj. Rm 5.5,5,Project Room,4
Li Ka Shing Library (Bras Basah),Proj. Rm 5.6,5,Project Room,4
Li Ka Shing Library (Bras Basah),Proj. Rm 5.7,5,Project Room,4
School of Accountancy/School of Law (Bras Basah),SOA/SOL Class Rm 2-1 (Rm 2023),2,Class Room,25
School of Accountancy/School of Law (Bras Basah),SOA/SOL Grp Study Rm 2-1 (Rm 2001),3,Group Study Room,6
The first 3 lines are able to insert into the database correctly but the next 2 lines is having some problems.

I suspect that it is still to the "/" between the words "School of Accountancy and School of Law" that is breaking the Preparedstatement.

Is there anyone who have encountered something similar before?

Edit: I realised that if I try to hardcode the query directly into mySQL query browser:

code:
INSERT INTO room (room_desc, room_type, room_building, max_capacity) VALUES ("SOA/SOL Class Rm 2-1 (Rm 2023)"," Class Room", "School of Accountancy/School of Law (Bras Basah)","25");
It works perfectly.

Something is wrong.

invid fucked around with this message at 12:40 on Sep 3, 2008

zootm
Aug 8, 2006

We used to be better friends.
Could be a shaky JDBC driver I guess. Without the actual error this'll be basically impossible to diagnose though.

invid
Dec 19, 2002
How can I check the error?

zootm
Aug 8, 2006

We used to be better friends.
If you're having problems, surely an exception was thrown?

Also I've noticed that in your SQL statement you pass the last argument as a string, whereas in your Java code you set it as a number. Depending on your database this could cause a problem.

invid
Dec 19, 2002
hi zoot, the order was changed during the parsing,

I ignored the last value from the csv file. The type is confirmed to be correct.

As for the exceptions, none were thrown for some weird reason. It just that it never made it into the database.

I did a small script to debug.

Here's the script in action:

code:
                String PATH_NAME = getServletContext().getRealPath("/") + "uploads/facility.csv";
		CSVReader reader = new CSVReader(new FileReader(PATH_NAME), ',');                  
		DataManager accessDB = new DataManager();
                String [] nextLine;
                
                if (reader.readNext() != null) {
                    reader.readNext();
                int counter = 0;
		while ((nextLine = reader.readNext()) != null) {
                    String building = nextLine[0];
                    String desc = nextLine[1];
                    String type = nextLine[3];
                    int capacity = Integer.parseInt(nextLine[4]);
                    
                    Boolean completed = accessDB.facilityBootstrap(building, desc, type, capacity);
                    
                    out.println("[" + counter + "]" + completed + "<br />" + building +" | "+ desc + "  | " + type + capacity);
                   
                    counter++;
                    
                }
                
                }
                
                else {
                    out.println("NULL YO!");
                }
Here's that facilitybootstrap method:

code:
public boolean facilityBootstrap(String building, String desc, String type, int capacity) {
        try {


            

            ps = conn.prepareStatement("INSERT INTO room (room_desc, room_type, room_building, max_capacity) VALUES (?,?,?,?);");
            ps.setString(1, desc);
            ps.setString(2, type);
            ps.setString(3, building);
            ps.setInt(4, capacity);
            ps.executeUpdate();

            return true;
        } catch (SQLException e) {
            
            return false;
        }
Results:
code:
Lee Kong Chian School of Business (Bras Basah) | LKCSB GSR 3-35 (Rm 3059) | Group Study Room6 [66]false
Lee Kong Chian School of Business (Bras Basah) | LKCSB Seminar Rm 1-1 (Rm 1013) [networked] | Networked Seminar Room55 [67]false
Lee Kong Chian School of Business (Bras Basah) | LKCSB Seminar Rm 1-2 (Rm 1014) [networked] | Networked Seminar Room70 [68]false
Lee Kong Chian School of Business (Bras Basah) | LKCSB Seminar Rm 2-2 (Rm 2002) [networked] | Networked Seminar Room70 [69]false
Lee Kong Chian School of Business (Bras Basah) | LKCSB Seminar Rm 2-3 (Rm 2004) [networked] | Networked Seminar Room70 [70]false
Lee Kong Chian School of Business (Bras Basah) | LKCSB Seminar Rm 2-6 (Rm 2013) [networked] | Networked Seminar Room45 [71]false
Lee Kong Chian School of Business (Bras Basah) | LKCSB Seminar Rm 2-7 (Rm 2014) [networked] | Networked Seminar Room45 [72]true
Been cracking my head to find the reason why its giving me false completion

zootm
Aug 8, 2006

We used to be better friends.
You're catching the SQLException and not using its value. Try at least printing it out.

nonathlon
Jul 9, 2004
And yet, somehow, now it's my fault ...
Library choosing question: having made the jump from C++, I'll be doing some numerical computation work (multidimensional arrays, stats etc.) with Java. Which leads to the problem: what library do I use? For example, in Python, while there are a number of packages, there's really only one that anyone uses (Numpy). In C, the choice is less clear but there's a big community / lot of users for LAPACK and GSL. What's the Java equivalent if any? Is there an undisputed leader in numerical computation? And is there a similar leader for graphing and visualization?

ignorant slut
Apr 27, 2008
Quick Java NullPointerException question...

I just started learning Java (making the jump from C++), and I still don't fully understand some of the nuances of the new language.

Anyways, I'm currently working on a homework assignment in which I have to implement a dorm/student registration and selection tool. When I try to compile my project, I receive the following error:

code:
Exception in thread "main" java.lang.NullPointerException
	at Application.addDorm(Application.java:46)
	at Application.main(Application.java:35)
I've looked at my code several times, but I can't seem to find any obvious errors. One thing to note is that I don't have much experience with HashMaps, so maybe I am not using it correctly? I think I might just need another pair of eyes to help find a dumb mistake.

Application.java //has a menu() method that controls everything

Dorm.java //comprised of Floors

Floor.java //comprised of Students

Student.java

Thanks in advance for your time and any help you may give me, it is much appreciated!

Minus Pants
Jul 18, 2004

ignorant slut posted:

code:
Exception in thread "main" java.lang.NullPointerException
	at Application.addDorm(Application.java:46)
	at Application.main(Application.java:35)

The "dorms" HashMap is null. Initialize it...
HashMap<Integer, Dorm> dorms = new HashMap<Integer,Dorm>();

standard
Jan 1, 2005
magic

ignorant slut posted:

Quick Java NullPointerException question...
...snip...
Thanks in advance for your time and any help you may give me, it is much appreciated!

Use debug mode and breakpoints in whatever IDE you are running and you should be able to work out any NullPointer. Anyway...


I've not ran your code but after a quick look it looks like you've not instantiated your HashMaps.

HashMap<Integer, Dorm> dorms;
should be
Map<Integer, Dorm> dorms = new HashMap<Integer, Dorm>();

You've done this with the other Maps in other classes as as well.

Anyway I think you've misunderstood what HashMaps are for here. They are like a dictionary, IE store Key Value pairs. From your code, it looks like you don't want to do this as you are just using sequential numbers as keys.

In this instance just use an ArrayList for holding your dorms, floors and students:
List<Dorm> dorms = new ArrayList<Dorm>();

standard fucked around with this message at 21:19 on Sep 6, 2008

ignorant slut
Apr 27, 2008

Minus Pants posted:

The "dorms" HashMap is null. Initialize it...
HashMap<Integer, Dorm> dorms = new HashMap<Integer,Dorm>();

standard posted:

I've not ran your code but after a quick look it looks like you've not instantiated your HashMaps.

HashMap<Integer, Dorm> dorms;
should be
Map<Integer, Dorm> dorms = new HashMap<Integer, Dorm>();

You've done this with the other Maps in other classes as aswell.

Looks like you've done this elsewhere with your other objects..

Application.java:13
Student tempStudent;
needs to be instantiated before Application.java:70 will work, but it looks like you've not started to implement that yet anyway.

That was it, thank you much guys!

standard posted:

Anyway I think you've misunderstood what HashMaps are for here. They are like a dictionary, IE store Key Value pairs. From your code, it looks like you don't want to do this as you are just using sequential numbers as keys.

In this instance just use an ArrayList for holding your dorms, floors and students:
List<Dorm> dorms = new ArrayList<Dorm>();

Ah, that makes a lot more sense. Thanks for the tip

ignorant slut fucked around with this message at 21:27 on Sep 6, 2008

standard
Jan 1, 2005
magic
Repeating this because your quoted me before I edited:

Anyway I think you've misunderstood what HashMaps are for here. They are like a dictionary, IE store Key Value pairs. From your code, it looks like you don't want to do this as you are just using sequential numbers as keys.

In this instance just use an ArrayList for holding your dorms, floors and students:
List<Dorm> dorms = new ArrayList<Dorm>();

It looks like you are making a decent stab at this so I don't mind chatting to you on MSN (Sorry I'm from the UK and no one uses AIM) if you have any more questions. I won't do your homework for you mind...

Email me your MSN from my profile if you want.

Entheogen
Aug 30, 2004

by Fragmaster
what is the fastest way to merge 2 binary files into one?

sarehu
Apr 20, 2007

(call/cc call/cc)

Entheogen posted:

what is the fastest way to merge 2 binary files into one?

Define "merge."

Flamadiddle
May 9, 2004

edit: Could someone tell me how to perform an HTTP POST operation from Java? I have all the code in place, but am getting "AccessControlException: access denied" errors.

I guess that the issue is down to permissions as I'm trying to access an external URL, but I don't get how to grant all permissions for testing. Anyone got any experience with this sort of thing?

edit2: Is HTTP POST even restricted in this way? I can get a Java application to do the exact thing I want, but I need to distribute it on our intranet, so I'd like to make it an applet. I've tried self-signing the applet, but it still won't allow me to make a call in the same way as the application.....

Flamadiddle fucked around with this message at 20:44 on Sep 9, 2008

adante
Sep 18, 2003
I want to... send a [method/closure/function/some computation sequence] that has been defined at runtime over the network :banjo: Is it possible in java?

For instance if I have some method wrapped in a class:

code:
public Class MethodWrap {
	static Object myMethod(Object arrr) { return "ARR!! " + arrr.toString(); }
}
the myMethod() call is not going to do anything fancy except do some computation, *maybe* access some java platform stuff (java.util.*), invoke methods on the arguments and so forth. The java versions on both sides will be identical.

is it possible for me to send this to another completely seperate java runtime which has no prior knowledge of the class?

I was thinking of trying to serialize the class (as in, the actual MethodWrap.class) into byte form, send it over network, unpack is and then somehow call ClassLoader#defineClass() to obtain a Class type, and use reflection to call the myMethod.

Problem is:
1. Don't know how to serialize MethodWrap.class. If I try something like Object o = MethodWrap.class and then serialize object o as I normally would, it creates a tiny byte[] array which obviously doesn't represent the full class.

2. Don't know how I would call defineClass() as it is a protected method. Are there other accessor/helper methods I should be using?

This is annoying hard to google as well. Anybody have any ideas?

zootm
Aug 8, 2006

We used to be better friends.
If you create an interface which defines your expected method call, you can avoid using reflection (build the class and then just newInstance it then cast to MyInterface or Callable<T> or whatever).

As for your "deeper" problem, I really don't know why serialising a Class instance doesn't work - it may "just work" unless the byte array is really tiny. Also, to load your own classes in a custom way, you probably want your own ClassLoader implementation - try subclassing ClassLoader (I don't think you need the extra gubbins that SecureClassLoader buys you but I could easily be wrong).

Of course the "outside the box" solution would be to use javax.script and define the function to be called in Javascript (comes with SE6) or any one of these languages (requires bundling the runtime for the language, which can get large). Then you just need to pass the string of the source. Probably completely over the top for any reasonable use-case though.

zootm fucked around with this message at 17:33 on Sep 9, 2008

Flamadiddle
May 9, 2004

I did a search and didn't find anything, but I can't work out what's wrong with my applet that talks to a database.

It works fine as an applet, but it uses a 3rd party driver (jtds), which is fine for the application, as I've happily added it to my CLASSPATH.

My problem comes in running as an applet. The applet can't find the .jar that holds the Driver class file, for obvious reasons. I've also had to compile the .class file into a .jar due to the security issues with applets.

When I try to run the applet, I get a
code:
java.lang.ClassNotFoundException: net.sourceforge.jtds.jdbc.Driver
error.

My question is, how do I include the Driver.class file in my compiled .jar file so that it knows where to find it? The internet is fruitless with this.

Edit: I've managed to get it to work by adding the .jar to the .html file as so:

code:

<applet code="sql.class" archive="sql.jar, jtds-1.2.2.jar"
........

is this the proper solution?

Flamadiddle fucked around with this message at 16:25 on Sep 16, 2008

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

Flamadiddle posted:

is this the proper solution?

It's a good solution for your immediate problem. I'm really worried about the fact that you want to open an external database connection from an applet, though. Is this for use purely behind a firewall?

zootm
Aug 8, 2006

We used to be better friends.

Flamadiddle posted:

is this the proper solution?
With applets, I think it is. Executable JAR files can specify their dependencies in their manifest, so that might work too. Also Java Web Start has a magic dependency mechanism of some kind as well. Actually if you're accessing a database through an applet, maybe a full-blown Web Start app is a better fit for your use-case.

Flamadiddle
May 9, 2004

rjmccall posted:

It's a good solution for your immediate problem. I'm really worried about the fact that you want to open an external database connection from an applet, though. Is this for use purely behind a firewall?

Not necessarily, no. Some staff may need to use the system from home. If there are major security issues with it, then I'll have to bring it up with the boss... It's just that the use of the database makes what we want to do much simpler. Would it make more sense to make a call to a server side application or something to seperate the user from the database?

zootm posted:

With applets, I think it is. Executable JAR files can specify their dependencies in their manifest, so that might work too. Also Java Web Start has a magic dependency mechanism of some kind as well. Actually if you're accessing a database through an applet, maybe a full-blown Web Start app is a better fit for your use-case.

Thanks for that. Do you have any decent sources on Web Start apps? I've not heard of them before.

Adbot
ADBOT LOVES YOU

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Flamadiddle posted:

It's just that the use of the database makes what we want to do much simpler. Would it make more sense to make a call to a server side application or something to seperate the user from the database?

This is the correct way to do it, you don't want random people on the internet to have direct access to your database.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply