how can i turn fully coded classes into a library?

52 Replies
JavaBot
JavaBot2w ago
This post has been reserved for your question.
Hey @matheofox! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
dan1st
dan1st2w ago
The first step would be to create a JAR file such JAR files can be used as libraries by other Java applications
matheofox
matheofoxOP2w ago
ok, how do i do that? i use intelij btw
dan1st
dan1st2w ago
Are you using a build tool like Maven or Gradle?
matheofox
matheofoxOP2w ago
gimme a sec i'll check (how do you check that?)
dan1st
dan1st2w ago
Is there a pom.xml, build.gradle or build.gradle.kts in your project?
matheofox
matheofoxOP2w ago
i use grovvy?
matheofox
matheofoxOP2w ago
No description
dan1st
dan1st2w ago
Which files are there in your project other than source files?
matheofox
matheofoxOP2w ago
i'
No description
dan1st
dan1st2w ago
ok you aren't using a build tool
matheofox
matheofoxOP2w ago
oh
dan1st
dan1st2w ago
So IntelliJ is capable of creating JAR files from your code
matheofox
matheofoxOP2w ago
is that a good or bad thing?
dan1st
dan1st2w ago
it's fine if you just want to create a JAR file
matheofox
matheofoxOP2w ago
wait
dan1st
dan1st2w ago
You can first create an artifact configuration for your JAR and then create the JAR
matheofox
matheofoxOP2w ago
i have this code right, and i want to be able to use it in diffrent projects without creating the classes, is that what a library do?
dan1st
dan1st2w ago
yes you can create a JAR and then use that JAR in other projects
matheofox
matheofoxOP2w ago
so i'll do the import thing ? all i have to do for library is to complie it ?
dan1st
dan1st2w ago
first you need to create a JAR
matheofox
matheofoxOP2w ago
ok how do i do that? is this what i'm supposed to follow?
dan1st
dan1st2w ago
yes
matheofox
matheofoxOP2w ago
ok thx but i don't want main, i only want the NeuralNetwork class
dan1st
dan1st2w ago
so?
matheofox
matheofoxOP2w ago
how do i only keep the NeuralNetwork, Nodes, Weights?
matheofox
matheofoxOP2w ago
so
No description
dan1st
dan1st2w ago
You don't need a main class
matheofox
matheofoxOP2w ago
but i can only pic main? *pick
dan1st
dan1st2w ago
A main class is for application JARs What exactly asks you to pick that class
matheofox
matheofoxOP2w ago
i don't understand this "good" level in java😭
matheofox
matheofoxOP2w ago
if i click the little floder logo on the right
No description
dan1st
dan1st2w ago
you can skip that field it's only for applications, not for libraries
matheofox
matheofoxOP2w ago
ok
matheofox
matheofoxOP2w ago
so do i have to do anything here?
No description
matheofox
matheofoxOP2w ago
or just press "ok"?
dan1st
dan1st2w ago
looks fine not so sure about the "copy the output directory and link via manifest" - because groovy might need it I guess that option might be better
matheofox
matheofoxOP2w ago
ah i alr compiled the thing
matheofox
matheofoxOP2w ago
No description
matheofox
matheofoxOP2w ago
should i chage it? or is this fine?
dan1st
dan1st2w ago
looks fine
matheofox
matheofoxOP2w ago
okok now what?
dan1st
dan1st2w ago
you should be able to take that JAR and import it in the other project
matheofox
matheofoxOP2w ago
and that's it?
dan1st
dan1st2w ago
yes
matheofox
matheofoxOP2w ago
how do i import it? oh i don't even need to do that
dan1st
dan1st2w ago
File > Project Structure I think
matheofox
matheofoxOP2w ago
i alr did that, but i don't need to import it futher welp, thanks
JavaBot
JavaBot2w ago
If you are finished with your post, please close it. If you are not, please ignore this message. Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
matheofox
matheofoxOP2w ago
i'll close the post, thanks for helping me :)))
JavaBot
JavaBot2w ago
Post Closed
This post has been closed by <@1043171326082424884>.

Did you find this page helpful?