how can i turn fully coded classes into a library?

52 Replies
JavaBot
JavaBot7mo 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
dan1st7mo ago
The first step would be to create a JAR file such JAR files can be used as libraries by other Java applications
matheofox
matheofoxOP7mo ago
ok, how do i do that? i use intelij btw
dan1st
dan1st7mo ago
Are you using a build tool like Maven or Gradle?
matheofox
matheofoxOP7mo ago
gimme a sec i'll check (how do you check that?)
dan1st
dan1st7mo ago
Is there a pom.xml, build.gradle or build.gradle.kts in your project?
matheofox
matheofoxOP7mo ago
i use grovvy?
matheofox
matheofoxOP7mo ago
No description
dan1st
dan1st7mo ago
Which files are there in your project other than source files?
matheofox
matheofoxOP7mo ago
i'
No description
dan1st
dan1st7mo ago
ok you aren't using a build tool
matheofox
matheofoxOP7mo ago
oh
dan1st
dan1st7mo ago
So IntelliJ is capable of creating JAR files from your code
matheofox
matheofoxOP7mo ago
is that a good or bad thing?
dan1st
dan1st7mo ago
it's fine if you just want to create a JAR file
matheofox
matheofoxOP7mo ago
wait
dan1st
dan1st7mo ago
You can first create an artifact configuration for your JAR and then create the JAR
matheofox
matheofoxOP7mo 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
dan1st7mo ago
yes you can create a JAR and then use that JAR in other projects
matheofox
matheofoxOP7mo ago
so i'll do the import thing ? all i have to do for library is to complie it ?
dan1st
dan1st7mo ago
first you need to create a JAR
matheofox
matheofoxOP7mo ago
ok how do i do that? is this what i'm supposed to follow?
dan1st
dan1st7mo ago
yes
matheofox
matheofoxOP7mo ago
ok thx but i don't want main, i only want the NeuralNetwork class
dan1st
dan1st7mo ago
so?
matheofox
matheofoxOP7mo ago
how do i only keep the NeuralNetwork, Nodes, Weights?
matheofox
matheofoxOP7mo ago
so
No description
dan1st
dan1st7mo ago
You don't need a main class
matheofox
matheofoxOP7mo ago
but i can only pic main? *pick
dan1st
dan1st7mo ago
A main class is for application JARs What exactly asks you to pick that class
matheofox
matheofoxOP7mo ago
i don't understand this "good" level in java😭
matheofox
matheofoxOP7mo ago
if i click the little floder logo on the right
No description
dan1st
dan1st7mo ago
you can skip that field it's only for applications, not for libraries
matheofox
matheofoxOP7mo ago
ok
matheofox
matheofoxOP7mo ago
so do i have to do anything here?
No description
matheofox
matheofoxOP7mo ago
or just press "ok"?
dan1st
dan1st7mo 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
matheofoxOP7mo ago
ah i alr compiled the thing
matheofox
matheofoxOP7mo ago
No description
matheofox
matheofoxOP7mo ago
should i chage it? or is this fine?
dan1st
dan1st7mo ago
looks fine
matheofox
matheofoxOP7mo ago
okok now what?
dan1st
dan1st7mo ago
you should be able to take that JAR and import it in the other project
matheofox
matheofoxOP7mo ago
and that's it?
dan1st
dan1st7mo ago
yes
matheofox
matheofoxOP7mo ago
how do i import it? oh i don't even need to do that
dan1st
dan1st7mo ago
File > Project Structure I think
matheofox
matheofoxOP7mo ago
i alr did that, but i don't need to import it futher welp, thanks
JavaBot
JavaBot7mo 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
matheofoxOP7mo ago
i'll close the post, thanks for helping me :)))
JavaBot
JavaBot7mo ago
Post Closed
This post has been closed by <@1043171326082424884>.

Did you find this page helpful?