Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Search - "classpath"
-
OMG... this client is killing me...
So they are writing a Java / SpringBoot app for whatever. For some reason they decided to write it in the overcomplicated way, i.e. using a custom Spring's BeanPostProcessor that changes the eventual type of some beans, causing some weird ass issues, causing the app to fail to boot up if built on some systems and start up just fine if built on others (https://stackoverflow.com/questions...).
I've advised the client (devs) to simplify the architecture and avoid using type-mutating BPPs (bcz.. you know.. noone does that..).
Instead, the client created a task for me to "remove the build logic creating JAR packages" and another "Create a shell script manually assembling the CLASSPATH list and launching the application"
omg... what the hell is going on? Am I on camera? This can't be real... in 202-fucking-4 in a greenfield project!!!
wtf...1 -
Me:
Hey Java, mind letting me compile and run this single class project that prints 'hello world'
Java:
Did you: add a manifest file, configure your classpath properly, ensure that the VM on the system matches the compiled version, make sure all libraries are included in the compilation and ensure the jar is a runable application?
*sweats*8 -
During my professional education (loooooong time ago), i once tried to figure out, why my java application runs perfectly fine on windows, but the same application isn't able to find the required classes to run on linux.
Since i was a noob respecting linux management, i had no idea, that it is necessary to separate different paths of a program for the parameter "classpath" in windows by using ":" and in linux by using ";".
I mean. Is it really that hard to enable both separator for folders in classpath.
Man! It still haunts me from time to time after decades of development ^^3 -
rant & question
What am I supposed to do to finally get log4j working?? It just doesn't want to log in my project. Or it simply hates me. However many tutorials and documentation I've followed, even copy pasting simplest examples with ConsoleAppendet, setting the xml config to classpath.
It starts with default fallback logging.
How do all the tutorials automagically work??1 -
And there I was thinking Maven is going to make life simpler, with this granular dependency management and IDE independence (no extraneous classpath and module management required). But wait, it turns out that to run simple Ant task I need all my dependencies to have *.pom. Every. Fricking. Dependency.
I mean, sure, only if I knew which sub-dependencies they all had, but that seems like heck a lot of work to make external JAR libraries to work with Maven process.
WHY TODAY? Yesterday I had no issue: uploaded few libraries in corporate repository, refreshed index, dependencies downloaded, even had time appending javadoc to one of them and it worked. But today is the day, right? I just run simple task with maven-antrun-plugin (mvn antrun:run@<executionID>), and it starts scanning each dependency for *.pom file. I DON'T WANT THIS. Google, help me. Oh, no direct answers and clues?
Just... fuck you, Maven. With all 2 days effort I could just litter in IDE's classpath, write build.xml in no time, make normal webservice, but that would require me to also litter sources with required libraries. FML!4 -
my maven project was working fine in windows but showing a lot of errors in Ubuntu's eclipse. so,I uploaded my to Github & I cloned it in my ubuntu only to find that I forgot to remove a jar from the classpath. I felt so silly afterwards but yeah,I think that was cool! 😋
-
Please give your opinions/experience, I'm tired of meetings with the legal team. :(
Can a proprietary software link to a GPL-licensed dependency during runtime?
Can it do if its GPL "with Classpath Exception"? What about CDDL?
Case in point - propriety Java web app needs javax.* libraries (JakartaEE components) at runtime (from project or JavaEE app server), but they are licensed under GPL.
Can they be used or is there any workaround?6 -
My journey along Java continues and so I have discovered something I didn't know before:
If a subclass tries to call a method on its parent which it has not overridden, then it will call the method as if you hadn't used the keyword 'super' (and I think it will try to find it in the classpath and SDK).
Example 1:
public class SuperParent {
public String test(){
return "SuperParent";
}
}
public class Parent extends SuperParent {
}
public class Child extends Parent {
public String testChild(){
return super.test(); // same effect as test();
}
}
public class TestInheritance {
public static void main(String[] args) {
System.out.println(new Child().test()); // returns "SuperParent"
}
}
Example 2: with getClass():
public class Parent {
@Override
public String toString(){
return super.getClass().getSimpleName();
}
}
public class Child extends Parent {
}
public class TestInheritance {
public static void main(String[] args) {
System.out.println(new Child()); // prints "Child"
}
}
This here is of course a special case: .getClass() will always return the class name of its caller, so naturally in this case it returns Child and not Parent.
You would expect it to return "Parent" since you use 'super' in the overridden toString() but it returns the Class name of the Child (then there's something in programming languages such lexical scope and execution scope, which I'm not sure if it applies here).
The solution for this example is of course .getSuperClass().
Inheritance isn't always straight-forward.
References:
https://stackoverflow.com/questions...
https://stackoverflow.com/questions...2 -
If I app.properties in src/resources in a jar.
And load it in code I guess using Classloader.getResource()?
Can I override it at runtime? By I guess adding a different file but with same name into the classpath?9 -
Jackson has this adorable option of an array sintax to represent every object on a JSON where the first element of the array is the classpath of the type and the second is the object itself and someone thought it would be nice to use this notation on a REST API...
why? -
There is a new Java library very useful for building frameworks and in this library there is a particular classpath scan engine that deserves attention as it is original and powerful.
The peculiarity of this engine is the possibility to search classes over a path or the runtime classpath by concatenable and nestable criteria by exploiting the power of the lambda expressions on the native Java reflection elements such Class, Field, Method, Constructor, Module, Package, Annotation, etc ... thus giving the possibility therefore to carry out searches without limits and for any criterion that can be immaginated: this library is called Burningwave Core, it is open source and on the official wiki on github there are a lot of examples.5