move article files to new module

This commit is contained in:
Ssam 2022-11-20 12:15:45 +00:00
parent 0107dc4d11
commit 3c57c4d566
7 changed files with 2 additions and 87 deletions

View File

@ -14,5 +14,4 @@ This module contains articles about working with the Java Virtual Machine (JVM).
- [An Introduction to the Constant Pool in the JVM](https://www.baeldung.com/jvm-constant-pool)
- [List All the Classes Loaded in the JVM](https://www.baeldung.com/jvm-list-all-classes-loaded)
- [Static Fields and Garbage Collection](https://www.baeldung.com/java-static-fields-gc)
- [Difference Between Class.getResource() and ClassLoader.getResource()](https://www.baeldung.com/java-class-vs-classloader-getresource)
- More articles: [[<-- prev]](/core-java-modules/core-java-jvm)
- More articles: [[<-- prev]](/core-java-modules/core-java-jvm) [[next -->]](/core-java-modules/core-java-jvm-3)

View File

@ -1,19 +0,0 @@
package com.baeldung.resource;
import java.net.URL;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ClassGetResourceExample {
private static Logger logger = LoggerFactory.getLogger(ClassGetResourceExample.class);
public static void main(String[] args) {
URL resourceAbsolutePath = ClassGetResourceExample.class.getResource("/com/baeldung/resource/example.txt");
logger.info("Resource with absolute path = {}", resourceAbsolutePath);
URL resourceRelativePath = ClassGetResourceExample.class.getResource("example.txt");
logger.info("Resource with relative path = {}", resourceRelativePath);
}
}

View File

@ -1,21 +0,0 @@
package com.baeldung.resource;
import java.net.URL;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ClassLoaderGetResourceExample {
private static Logger logger = LoggerFactory.getLogger(ClassLoaderGetResourceExample.class);
public static void main(String[] args) {
URL resourceAbsolutePath = ClassLoaderGetResourceExample.class.getClassLoader()
.getResource("com/baeldung/resource/example.txt");
logger.info("Resource with absolute path = {}", resourceAbsolutePath);
URL resourceRelativePath = ClassLoaderGetResourceExample.class.getClassLoader()
.getResource("example.txt");
logger.info("Resource with relative path = {}", resourceRelativePath);
}
}

View File

@ -1,21 +0,0 @@
package com.baeldung.resource;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import java.net.URL;
class ClassGetResourceUnitTest {
@Test
void givenRelativeResourcePath_whenGetResource_thenReturnResource() {
URL resourceRelativePath = ClassGetResourceExample.class.getResource("example.txt");
Assertions.assertNotNull(resourceRelativePath);
}
@Test
void givenAbsoluteResourcePath_whenGetResource_thenReturnResource() {
URL resourceAbsolutePath = ClassGetResourceExample.class.getResource("/com/baeldung/resource/example.txt");
Assertions.assertNotNull(resourceAbsolutePath);
}
}

View File

@ -1,23 +0,0 @@
package com.baeldung.resource;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import java.net.URL;
class ClassLoaderGetResourceUnitTest {
@Test
void givenRelativeResourcePath_whenGetResource_thenReturnNull() {
URL resourceRelativePath = ClassLoaderGetResourceExample.class.getClassLoader()
.getResource("example.txt");
Assertions.assertNull(resourceRelativePath);
}
@Test
void givenAbsoluteResourcePath_whenGetResource_thenReturnResource() {
URL resourceAbsolutePath = ClassLoaderGetResourceExample.class.getClassLoader()
.getResource("com/baeldung/resource/example.txt");
Assertions.assertNotNull(resourceAbsolutePath);
}
}

View File

@ -74,6 +74,7 @@
<module>core-java-jndi</module>
<module>core-java-jvm</module>
<module>core-java-jvm-2</module>
<module>core-java-jvm-3</module>
<module>core-java-lambdas</module>
<module>core-java-lang</module>
<module>core-java-lang-2</module>