Questions tagged [java.lang]

58 questions
37
votes
4 answers

Why I am able to re-create java.lang package and classes?

I am just playing with package structure. And to my surprise I can bypass the default classes by creating my package and class name with that name. For ex: I created a package called java.lang and Class is Boolean. When I import java.lang.Boolean…
Suresh Atta
  • 114,879
  • 36
  • 179
  • 284
13
votes
2 answers

java.lang.NoClassDefFoundError: java.util.Objects

I'm getting the following crash report in Android development Console. My app runs fine on the simulator or devices that I tried the app on, but for some reason on a Galaxy Nexus (Maguro) it doesn't run. I don't get any compile errors…
Juan H
  • 145
  • 1
  • 5
7
votes
1 answer

RuntimeMXBean.getName() hangs on Mac OS X Sierra - how to fix?

If I run the following on OS X Sierra (JDK 8u111), it takes 5 seconds to run (as opposed to milliseconds on e.g. Linux): import java.lang.management.ManagementFactory; import java.lang.management.RuntimeMXBean; public class BeanTest { public…
tla
  • 553
  • 3
  • 7
5
votes
5 answers

Nullsafe Long valueOf

Imagine the following scenario Long critId = Long.valueOf(criteriaIdentifier); If the view is initially loaded criteriaIdentifier may be null, afterwards I set the value depending of the selectedItem in the JSF View. However,…
0x45
  • 587
  • 3
  • 6
  • 22
5
votes
1 answer

Is java.lang.Math compatible with kotlin.math?

I was learning Kotlin and ran into this issue in Math class: The java.lang.Math and kotlin.math are not compatible. This is for me a little bit awkward and confusing since Kotlin claims that it is 100% compatible with Java. Maybe this is only me who…
Dilshad Abduwali
  • 1,218
  • 7
  • 24
  • 38
5
votes
2 answers

NetBeans Clean & Build Android error: Java.Lang X500Principal access

I’m wondering if anyone can help on this one. An error occurs when cleaning and building the simplest of projects. (see below) Steps leading to error: As a new employee and therefore new user on a machine no older than 4 months, I started by…
Zeenglishking
  • 63
  • 3
  • 10
4
votes
2 answers

Ubuntu 18.04/Netbeans 10.0 Fatal Error: Unable to find package java.lang in classpath or bootclasspath

First, I work on Ubuntu 18.04 with netbeans 10.0 and open JDK 11. When I create a basic new project, alerts directly triggered. cannot access java.lang Fatal Error: Unable to find package java.lang in classpath or bootclasspath I tried to…
3
votes
1 answer

Java: Why does "Character newChar = 'c' " work if Character is a wrapper class? How come it doesn't need a constructor?

These are both fine for me: Example 1: Character newCharacter = 'c'; Example 2: Character newCharacterOther = new Character('c'); But what are the differences? In the first example, how does the Character class know to set its value to "c" without…
3
votes
3 answers

How to get a method using java reflection with only partial name as a string of the method?

I am trying to invoke a getter of a class, I have only the partial name such as "Name", "age" etc. I need to invoke the method from class like getName/retriveName dynamically based on the getters using java Reflection api. for eg: class…
Karthikeyan
  • 439
  • 1
  • 4
  • 8
3
votes
0 answers

Error with Ivy: sbt assembly java.lang.AssertionError java.lang.IllegalStateException

I installed spark 1.6.0, java 1.8.0_73 and sbt 0.13.9 on my Mac (El Capitan) When I type sbt assembly I get the following error. [error] (sql/compile:compile) java.lang.AssertionError: assertion failed: List(object package$DebugNode, object…
MKR
  • 51
  • 5
2
votes
0 answers

Return of doubleValue() method of java.lang.Number class

i need your help in following code snap. public class Ex1 { public static void main(String[] args) { Number number = new Float(1000000.211); System.out.println(number); System.out.println(number.byteValue()); …
1
vote
0 answers

AndroidRuntime: FATAL EXCEPTION: java.lang.RuntimeException: Unable to instantiate activity ComponentInfo Didn't find class on path: DexPathList

im trying to open application after building project in android studio. and see this fatal error! im using andrid studio 4 gradle 6.1.1 and Launching 'app' on Pixel_3a_API_30_x86. please help me fol solve this problem my build tools version is:…
1
vote
1 answer

Android Java.Lang Locale Number Format I/O Asymmetry Problem

Historically the Android phones sold in South Africa provided English.US and English.UK locale support, but recently English.ZA (South Africa) has made an appearance, on Android 9.0 Samsung Galaxy A10, for example. This particular Locale is showing…
MKhomo
  • 161
  • 8
1
vote
3 answers

I got this error"operator + cannot be applied to java.lang.string void"

I tried to call a method in printlnfrom a super class using the object that I have created for the super class. I got this error "operator + cannot be applied to java.lang.string void" System.out.println("Contents of objsuper: " +…
1
vote
1 answer

How to count digits in BigDecimal?

I’m dealing with BigDecimal in Java and I need to make 2 check against BigDecimal fields in my DTO: Number of digits of full part (before point) < 15 Total number of digits < 32 including scale (zeros after point) What is the best way to…
Pasha
  • 1,438
  • 1
  • 13
  • 33
1
2 3 4