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
tyang209
Feb 17, 2007
I am a stupid and don't know how to delete posts.

tyang209 fucked around with this message at 16:02 on Nov 10, 2011

Adbot
ADBOT LOVES YOU

Max Facetime
Apr 18, 2009

tyang209 posted:

I can't use next() without getting this error and the program should compile. This should compile as I grabbed this off my course website as an example program and it did compile on Dr Java for Mac but I'm getting that ambiguous invocation error on my PC. Totally confused as to why. Could anyone drop some knowledge on me?

DrJava is doing its own type-checking and is getting it wrong. I think it's getting confused with

T next() in Iterator<T> and the overriding method
String next() in Scanner, which implements Iterator<String>

Are you required to use DrJava? Eclipse and Java 7 should do almost everything DrJava does if you can google the UI.

Don Wrigley
Jun 8, 2006

King O Frod
Thought I'd be smart and try to use Spring's ridiculously simple dependency/property value injection for the purpose of passing in a property and seeing if we're in production, so the following:

code:
@Service
public class SomeService {
  
  @Value("${uat.property}") private String inUat;
 
  public void doSomething()
  {
    if(inUat==null)
    {
      //we're in PROD so do something different!
    }
  }
}
I figured this would be elegant, and when we moved to prod, it wouldn't find the value in the application context properties, so it would default to 'null'. Now finding that the default behavior in prod is to say "can't find uat.property, therefore can't build bean". Is there any way around this, or will I have to do something less elegant?

Paolomania
Apr 26, 2006

Use different values in development and production builds?

cenzo
Dec 5, 2003

'roux mad?
You mean everyone doesn't use a server variable called ServerEnvironment ?

Paolomania
Apr 26, 2006

cenzo posted:

You mean everyone doesn't use a server variable called ServerEnvironment ?

LOL, yes ideally software shouldn't require environment variables to be set just-so, unfortunately if this is your expectation then your heart will be broken over and over and over again.

It has been a while since I've done Spring, but I'm pretty sure we used to just use PropertyPlaceholderConfigurer with ignoreUnresolvablePlaceholders on to load (or not load) various properties files into Java system properties, and then used System.getProperty(key,defaultValue) to revert to a default value if a certain property was not found.

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

Paolomania posted:

LOL, yes ideally software shouldn't require environment variables to be set just-so, unfortunately if this is your expectation then your heart will be broken over and over and over again.

It has been a while since I've done Spring, but I'm pretty sure we used to just use PropertyPlaceholderConfigurer with ignoreUnresolvablePlaceholders on to load (or not load) various properties files into Java system properties, and then used System.getProperty(key,defaultValue) to revert to a default value if a certain property was not found.

ignoreUnresolvablePlaceholders is probably what he wants. I don't know what will happen however, when the annotation attempts to "dereference" the property. It will probably explode at runtime.

My Rhythmic Crotch
Jan 13, 2011

I apologize if this has been asked before because this is a huge thread, but here goes...

I'm using PDFBox to extract text out of PDFs. Some PDF files are giving me trouble, like this one: http://www.atmel.com/dyn/resources/prod_documents/11100S.pdf

PDFBox considers that file "encrypted" and requires a password to decrypt it. Yet I can use a page like this: http://pdf2html.tabesugi.net:8080/ and extract the text no problem.

What am I missing here? Is it possible to extract the text using PDFBox with no password, and I've just overlooked it?

EDIT: It is completely possible to do this with PDFBox. The sample application for PDFBox does this, and I even included the stupid bouncy castle jars in my classpath. The problem was that my ant buildscript somehow did not get updated to include the bouncy caste jars... ARRGGG.

Everything works fine now!

My Rhythmic Crotch fucked around with this message at 17:51 on Nov 13, 2011

cenzo
Dec 5, 2003

'roux mad?

Paolomania posted:

LOL, yes ideally software shouldn't require environment variables to be set just-so, unfortunately if this is your expectation then your heart will be broken over and over and over again.

It has been a while since I've done Spring, but I'm pretty sure we used to just use PropertyPlaceholderConfigurer with ignoreUnresolvablePlaceholders on to load (or not load) various properties files into Java system properties, and then used System.getProperty(key,defaultValue) to revert to a default value if a certain property was not found.

My world, it has been destroyed.

Next you guys will tell me you log to somewhere other than sysout! If you do this thing, I might :suicide: (joke)

Seriously though, I thought it was kind of elegant to be able to have an entire app function on a different deployment level (prod,test,int etc) just by changing 1 variable. Upon reflection, I suppose that should probably be done at build-time.

This thread, it always delivers.

Volguus
Mar 3, 2009

cenzo posted:

My world, it has been destroyed.

Next you guys will tell me you log to somewhere other than sysout! If you do this thing, I might :suicide: (joke)

Seriously though, I thought it was kind of elegant to be able to have an entire app function on a different deployment level (prod,test,int etc) just by changing 1 variable. Upon reflection, I suppose that should probably be done at build-time.

This thread, it always delivers.

You're correct, at build time it should be determined what environment that build will run on. What you can do however (to make your life easier) use a build tool such as ant or maven, that when it has a certain variable passed it will know if it's for prod or for debug or for testing.
And build the application that way.

With ant for example, you can do something like: "ant -Ddeployment=prod" to set the "deployment" property in the build.xml file to value "prod".
And in the build.xml do whatever you have to do when compiling for prod.

Volguus
Mar 3, 2009
I have a question about hibernate and XToMany relationships.

It is an old story how the hibernate guys broke a lot of code with the 3.2 release with their new treatment of the "bags" (@OneToMany relations that are lists without an index).
And they had a good reason for it as well, as a guy explains in his blog: http://blog.eyallupu.com/2010/06/hibernate-exception-simultaneously.html .

On the forums, however, they haven't been helpful (or at least i haven't found the posts where they have), to explain to people how should they implement their relationships.
The most common answer I've seen on the forums from the devs is to use a Set. I can see their reasoning, and it's a sound one. However, using a Set poses a different set of problems (namely, one cannot just add children to the parent without an ID set. That is...before the children are saved).

Here is my situation:
code:
@Entity
@Table(name = "TVSHOW")
public class TVShow {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    @OneToMany(cascade={CascadeType.ALL},mappedBy="show")    
    @OrderBy("number DESC")
    private List<TVShowSeason> seasons=new ArrayList<TVShowSeason>();
}

@Entity
@Table(name="TVSHOWSEASON")
public class TVShowSeason {
	
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;	
    @ManyToOne(optional=false)
    @JoinColumn(name="SHOW_ID",updatable=false,nullable=false)
    private TVShow show;

    @OneToMany(cascade={CascadeType.ALL},mappedBy="season")    
    @OrderBy("airDate DESC")
    private List<TVShowEpisode> episodes=new ArrayList<TVShowEpisode>();
}

@Entity
@Table(name="TVSHOWEPISODE")
public class TVShowEpisode{

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    @ManyToOne(optional=false)
    @JoinColumn(name="SEASON_ID",updatable=false,nullable=false)
    private TVShowSeason season;

}
As it can be seen, I have 3 entities. A show that has seasons, and each season has episodes. All 3 entities have equals() and hashCode() overridden taking into consideration their ID. The collection implementation chosen is List, because I get the entire information for a show from outside sources, and it is surely nice to be able to just populate the data in memory and at the end just call session.save(show); .

However, this way obviously doesnt work when I want to fully load a show:
code:
		TVShow show=(TVShow)session.createCriteria(TVShow.class)
				.setFetchMode("seasons", FetchMode.JOIN)
				.setFetchMode("seasons.episodes", FetchMode.JOIN)
				.add(Restrictions.idEq(id))
				.uniqueResult();

I get the dreaded "cannot simultaneously fetch multiple bags" exception.

Now, there are many ways to skin this cat:
  1. When I want the show to be loaded fully in memory (eagerly load seasons and episodes), i can get the show, loop through the seasons and call a getEpisodes() on each season. Being in one transaction it may not be too bad performance wise.
  2. Change the List to be Set .
    That however, poses a problem in my case, as I get a lot of data at once. And, what I would have to do would be:
    1. Read show information. Save show
    2. For every season, read the information, setParent(show), and save. Then add to the show.seasons
    3. For every episode, read the information, setParent(season) and save. Then add to season.episodes
    This would be OK on a website when each item gets added individually, but when loading so much data at once?

Finally my question: what is the "best" way to do this? How did you guys do this when you had this problem?
I am aware that the "best" way may as well be an "depends", still I would like to know what maybe other approaches should I consider here?

Akarshi
Apr 23, 2011

Hey everyone, I'm back with another super noob question.
code:
	public static void decodeThis(BufferedImage im, String outputFile)
		throws FileNotFoundException{
		int w = im.getWidth();
		int h=im.getHeight();
		int[] arr=im.getRGB(0, 0, w, h, null, 0, w);
		int[] eightBit=new int[8];
		int counter=0;
		String[] aString=new String[arr.length];
		PrintStream out=new PrintStream(new File(outputFile));
		double value=0;
		int intVal=0;
		while (counter<arr.length){
			for (int j=0;j<eightBit.length;j++){
				eightBit[j] = arr[j+counter] & 1; //Extracts least significant bit, puts into eightBit array.
			}
			value=0;
			for (int x=0;x<eightBit.length;x++){
				value+=eightBit[x]*(Math.pow(2,x));
			}
			intVal=(int)value;
			out.print((char)intVal);
			counter=counter+8;
		}
	}
What I want to do is read, extract, and convert into a character 8 bits from arr while there are still pixels left to read in arr. For some reason when I run the commented for loop, I get an ArrayIndexOutOfBoundsException. How do I fix this? Thanks in advance!

Suran37
Feb 28, 2009
Ok so I need to make a method that normalizes an array of doubles. The teacher said it should set the first element to 0, and the last one to 1. I can't seem to get it to work for the SpecChecker( A JUnit test written to auto-grade us).

Here's my code:
code:
	public static double[] normalize(double[] doublesList) {

		double[] normalize = new double[doublesList.length];

		for (int i = 0; i < doublesList.length; ++i) {
			normalize[i] = doublesList[i];
		}

		double min = getMinimum(normalize);
		double max = getMaximum(normalize);
		
		for (int i = 0; i < normalize.length; ++i) {

			if (i == 0){
				normalize[i] = 0;
			}else if(i == normalize.length - 1){
				normalize[i] = 1;
			}else{
				normalize[i] = normalize[i] / (min + max);
			}
		}

		return normalize;

	}
And I'm getting this error:
normalize fails to normalize: arrays first differed at element [0]; expected:<1.0> but was:<0.0>

Malloc Voidstar
May 7, 2007

Fuck the cowboys. Unf. Fuck em hard.
Pretty sure you want the first element to be 1.0 and the last element to be 0.0, you've got it backwards.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

Akarshi posted:

code:
		while (counter<arr.length){
			for (int j=0;j<eightBit.length;j++){
				eightBit[j] = arr[j+counter] & 1; //Extracts least significant bit, puts into eightBit array.

What happens here, when counter is arr.length - 1, and j is something larger than 0?

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

rhag posted:


Finally my question: what is the "best" way to do this? How did you guys do this when you had this problem?
I am aware that the "best" way may as well be an "depends", still I would like to know what maybe other approaches should I consider here?

Well, instead of setting FetchMode.JOIN on both of the relations, will your app get killed by setting one to FetchMode.LAZY?

I just tested it myself and it seems to be happy, but I don't know what kind of processing you're doing after you get the entities.

Suran37
Feb 28, 2009

Aleksei Vasiliev posted:

Pretty sure you want the first element to be 1.0 and the last element to be 0.0, you've got it backwards.

No, it was suppose to be 0 to 1. I just had it wrong. You had to minus the minimum, then divide by the max minus the min.

Volguus
Mar 3, 2009

TRex EaterofCars posted:

Well, instead of setting FetchMode.JOIN on both of the relations, will your app get killed by setting one to FetchMode.LAZY?

I just tested it myself and it seems to be happy, but I don't know what kind of processing you're doing after you get the entities.

Well, i need the entire data for a web page.
If I lazy fetch (as i normally would do), i obviously would get the error that i don't have a transaction started. Since, by the time the TVShow object gets to the web page, the transaction has already been committed long time ago.
Therefore, it only makes sense to load the objects that i know I'll need, since i know that i won't be able to get to them after the transaction closed.

If i set one collection to be lazy loaded, I would have to do a loop in the DAO to get the second collection. No, the application wouldnt get killed, it's just ugly.
There are a lot of "ugly" ways of fixing the problem,I am under the impression that i'm missing something. A more elegant, nicer and ultimately easier (for now and future maintenance ) way of doing this.

But, it could be that there isnt anything that can be done about it.

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

rhag posted:

Well, i need the entire data for a web page.
If I lazy fetch (as i normally would do), i obviously would get the error that i don't have a transaction started. Since, by the time the TVShow object gets to the web page, the transaction has already been committed long time ago.
Therefore, it only makes sense to load the objects that i know I'll need, since i know that i won't be able to get to them after the transaction closed.

If i set one collection to be lazy loaded, I would have to do a loop in the DAO to get the second collection. No, the application wouldnt get killed, it's just ugly.
There are a lot of "ugly" ways of fixing the problem,I am under the impression that i'm missing something. A more elegant, nicer and ultimately easier (for now and future maintenance ) way of doing this.

But, it could be that there isnt anything that can be done about it.

From what I understand , this is a bug in hibernate that is set to WONTFIX. I suppose you could always try another JPA provider if you haven't polluted your classes with hibernate's droppings.

Sab669
Sep 24, 2009

I know there's a brief overview of a few IDEs on the first page, but I was hoping to get a little more information on Netbeans VS Eclipse.

I'm still a student, and when I took a Java course we used NetBeans. I'm taking a Design Patterns course this semester which is also in Java and the professor only lets us use Eclipse. So far, I'm not impressed with it at all- the intellisense seems slow as hell, unconventional hotkeys (at least, compared to what I'm used to) and just all around I don't feel comfortable in the environment.

Goons, why you do prefer one over the other?

HFX
Nov 29, 2004

Sab669 posted:

I know there's a brief overview of a few IDEs on the first page, but I was hoping to get a little more information on Netbeans VS Eclipse.

I'm still a student, and when I took a Java course we used NetBeans. I'm taking a Design Patterns course this semester which is also in Java and the professor only lets us use Eclipse. So far, I'm not impressed with it at all- the intellisense seems slow as hell, unconventional hotkeys (at least, compared to what I'm used to) and just all around I don't feel comfortable in the environment.

Goons, why you do prefer one over the other?

You shouldn't be forced to use either in a design patterns course. Ultimately, either IDE is useful to whatever you learned and how well you know it.


However, I prefer Eclipse because in general it is snappier for me. In fact, Eclipse originally was a huge breath of fresh air in terms of speed back when Netbeans was still known as Forte. I would also say Eclipse has a git plugin that work. However, there are times I am known to open Netbeans to do something because it is easier in Netbeans.

I would kill for an IDE which had a fully working emacs mode just as if I was using emacs.

Sedro
Dec 31, 2008

Sab669 posted:

I know there's a brief overview of a few IDEs on the first page, but I was hoping to get a little more information on Netbeans VS Eclipse.

I'm still a student, and when I took a Java course we used NetBeans. I'm taking a Design Patterns course this semester which is also in Java and the professor only lets us use Eclipse. So far, I'm not impressed with it at all- the intellisense seems slow as hell, unconventional hotkeys (at least, compared to what I'm used to) and just all around I don't feel comfortable in the environment.

Goons, why you do prefer one over the other?
I prefer Netbeans now (after years of using eclipse) because its Maven support is a million times better. I finally got fed up with using a bunch of crappy eclipse plugins.

HFX posted:

I would also say Eclipse has a git plugin that work.
Depending on your definition of "works".

HFX
Nov 29, 2004

Sedro posted:

Depending on your definition of "works".

I know which one you are talking about. I would not define that as works.

You are correct, that Netbeans does have great Maven support and a worthwhile reason to use it. I end up using the command line because the Eclipse plugins are so terrible.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

HFX posted:

I know which one you are talking about. I would not define that as works.

You are correct, that Netbeans does have great Maven support and a worthwhile reason to use it. I end up using the command line because the Eclipse plugins are so terrible.

If it's any consolation the mercurial plugin for NetBeans loving owns. If I rename a or move a file it will also do an hg rename. It makes refactoring code 100% easier than before. One of my favorite little features is CTRL+ALT clicking an interface and having it show me the list of implementing classes.

The only bug I frequently encounter is that the index doesn't get updated after fixing a compilation bug and having it mark the file in red. I have to delete my users .netbeans/var/cache/index folder completely for it to go away.

Lysidas
Jul 26, 2002

John Diefenbaker is a madman who thinks he's John Diefenbaker.
Pillbug

Sab669 posted:

Goons, why you do prefer one over the other?

The correct answer is IntelliJ Community Edition.

Max Facetime
Apr 18, 2009

MEAT TREAT posted:

One of my favorite little features is CTRL+ALT clicking an interface and having it show me the list of implementing classes.

Eclipse's CTRL-T is probably a close, also there's a method call hierarchy view for answering "who's calling this method from the wrong place".

I think the feature I like the most in Eclipse is its perspectives, which provide distinctive yet flexible layouts for different tasks.

So the editing perspective empathizes the overall structure of the code, debugging perspectives is about the execution details of the code and the version control perspective is for reviewing incoming and outgoing changes.

Malloc Voidstar
May 7, 2007

Fuck the cowboys. Unf. Fuck em hard.
Is there any way to display a message to a user if something is missing from the classpath?

Scenario is:

GUIApp.jar
lib\lib1.jar
lib\lib2.jar
lib\lib3.jar


If any of the libraries are missing, the GUI will simply fail to appear with no message. Running it with java -jar will of course show the stacktrace, but is there any way to make it pop up a message saying "Hey you're missing these files"?
The libraries are defined in the manifest, if that matters. And the GUI is Swing.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
The easiest way to deal with that is to catch the ClassNotFoundException and display the error dialogue in the corresponding catch block.

Malloc Voidstar
May 7, 2007

Fuck the cowboys. Unf. Fuck em hard.
Thanks, this worked!
code:
    public static void main(String... args) {
        try {
            // create app
        } catch (NoClassDefFoundError err) {
	    String msg = "Missing class!\n(" + err.getMessage() + ")";
	    JOptionPane.showMessageDialog(null, msg, "Fatal error", JOptionPane.ERROR_MESSAGE);
        }
    }

Partyworm
Jul 8, 2004

Tired of partying
Does anyone know why when i implement the following method to recenter the cursor in response to mouse movement, it prevents the sprite assigned to it from receiving the mouse event (i.e. the sprite stays completely static)?

code:
private synchronized void recenterMouse() {
        if (robot != null && comp.isShowing()) {
            centerLocation.x = comp.getWidth() / 2;
            centerLocation.y = comp.getHeight() / 2;
            SwingUtilities.convertPointToScreen(centerLocation,
                comp);
            isRecentering = true;
            robot.mouseMove(centerLocation.x, centerLocation.y);
        }
    }
The confusing part is, it worked fine when my game was running in full screen, but not since I've switched over to windowed mode. Not sure if that's much of a clue, but it's all I've really got to go on right now. I'm such a terrible programmer :(

Partyworm fucked around with this message at 20:42 on Nov 20, 2011

blargle
Apr 3, 2007
Has anyone used the Maven m2e eclipse plugin lately?
I'm getting this error in the POM when using the webapp-javaee6 archetype (the other webapp archetypes seem ancient):

code:
Plugin execution not covered by lifecycle configuration: 
org.apache.maven.plugins:maven-dependency-plugin:2.1:copy 
(execution: default, phase: validate)
code:
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-dependency-plugin</artifactId>
  <version>2.1</version>
  <executions>
    <execution>
      <phase>validate</phase>
      <goals>
       <goal>copy</goal>
      </goals>
      <configuration>
        <outputDirectory>${endorsed.dir}</outputDirectory>
        <silent>true</silent>
        <artifactItems>
          <artifactItem>
	    <groupId>javax</groupId>
            <artifactId>javaee-endorsed-api</artifactId
            <version>6.0</version>
            <type>jar</type>
          </artifactItem>
        </artifactItems>
      </configuration>
     </execution>
  </executions>
</plugin>

smug forum asshole
Jan 15, 2005
I'm new to java and need to get a web server running with tomcat and maven on a Mac. anyone have suggestions for getting up and running with relatively little pain?

Paolomania
Apr 26, 2006

All you need to do to run Tomcat on a Mac is extract the archive and run scripts/startup.sh

pigdog
Apr 23, 2004

by Smythe

Lysidas posted:

The correct answer is IntelliJ Community Edition.
This is the correct answer. It's stable, fast, free (CE), and has good usability. It's pretty impressive how fast a proficient person can code with it. For just Java you don't particularly need the commercial version, either.

baquerd
Jul 2, 2007

by FactsAreUseless

pigdog posted:

This is the correct answer. It's stable, fast, free (CE), and has good usability. It's pretty impressive how fast a proficient person can code with it. For just Java you don't particularly need the commercial version, either.

It's SVN support is piss poor though and has resulted in a poo poo ton of integration problems when other devs are using command line SVN. It also has occasional problems with caching things that has resulted in a couple of truly :wtf: debugging sessions. I like it better than Eclipse though and Netbeans to me is crap due to the user interface.

Harvey Mantaco
Mar 6, 2007

Someone please help me find my keys =(
Hey folks,

I haven't written anything in Java in forever and I've been cruising through my old notes catching up. Using Eclipse hasn't given me any issues yet, but It might be an Eclipse issue I guess - I never really used it before. Things have been going really well but I ran into the following example that I guess was working at one time involving reflection (what it's trying to do doesn't matter, doesn't even get to that point yet):

package ReflectionEx;

import java.lang.reflect.*;

public class Field2 {

public double d;

public static void main(String args[])
{
try {
Field2 f2obj = new Field2();
Class<?> cls = Class.forName("Field2");
Field fld = cls.getField("d");

System.out.println("d = " + f2obj.d);
fld.setDouble(f2obj, 12.34);
System.out.println("d = " + f2obj.d);
}
catch (Throwable e) {
System.err.println(e);
}
}
}

Running this I get a "java.lang.ClassNotFoundException: Field2" on the "Field2 f2obj = new Field2();" line.
Seems like it should see it. I have everything typed correctly I think... so I'm not quite sure. Might be something silly.

1337JiveTurkey
Feb 17, 2005

Try ReflectionEx.Field2. Any time you're referring to a Class by its name, you need to fully qualify it rather than letting the computer decide whether you're really trying to reflectively get the class for java.awt.List or java.util.List.

Harvey Mantaco
Mar 6, 2007

Someone please help me find my keys =(

1337JiveTurkey posted:

Try ReflectionEx.Field2. Any time you're referring to a Class by its name, you need to fully qualify it rather than letting the computer decide whether you're really trying to reflectively get the class for java.awt.List or java.util.List.

I never really considered that and it absolutely worked. Makes sense.

Brilliant - Thank you.

My Rhythmic Crotch
Jan 13, 2011

Another stupid Java question:

Is there something I can do in Eclipse so that I don't have to include the library path when I'm launching a jar? What I mean is this:
code:
java -jar -Djava.library.path=/usr/local/lib application.jar
Is my only option to symlink or copy the library modules into a place where my system usually looks? How can I find out where the system is looking for these library modules? I added /usr/local/lib to the $PATH but it does not help. This is on OS X by the way... ugh.

Adbot
ADBOT LOVES YOU

No Safe Word
Feb 26, 2005

hootimus posted:

Another stupid Java question:

Is there something I can do in Eclipse so that I don't have to include the library path when I'm launching a jar? What I mean is this:
code:
java -jar -Djava.library.path=/usr/local/lib application.jar
Is my only option to symlink or copy the library modules into a place where my system usually looks? How can I find out where the system is looking for these library modules? I added /usr/local/lib to the $PATH but it does not help. This is on OS X by the way... ugh.

You should just be able to add external JARs to your project. Right-click on your project and I think it's under "Source" there should be an option to add an external JAR.

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